Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add minimal API for language switching #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/clappr-dash-shaka-playback.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ class DashShakaPlayback extends HTML5Video {
return this.isReady && this._player.getTextTracks()
}

get audioLanguages () {
return this.isReady && this._player.getAudioLanguages();
}

get audioTracks () {
return this.isReady && this._player.getVariantTracks().filter((t) => t.mimeType.startsWith('audio/'))
}
Expand All @@ -215,6 +219,10 @@ class DashShakaPlayback extends HTML5Video {
return (this.isReady && this._player.isLive() ? 'live' : 'vod') || ''
}

selectAudioLanguage (language, role=null) {
this._player.selectAudioLanguage(language, role);
}

selectTrack (track) {
if (track.type === 'text') {
this._player.selectTextTrack(track)
Expand Down Expand Up @@ -449,6 +457,7 @@ class DashShakaPlayback extends HTML5Video {
bandwidth: activeVideo.bandwidth,
width: activeVideo.width,
height: activeVideo.height,
language: activeVideo.language,
joaopaulovieira marked this conversation as resolved.
Show resolved Hide resolved
level: activeVideo.id,
bitrate: activeVideo.videoBandwidth
})
Expand Down