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

feat: Add safeMargin as a parameter of the player selectAudioLanguage method #5316

Merged
merged 1 commit into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Code It <*@code-it.fr>
Damien Deis <[email protected]>
Dany L'Hébreux <[email protected]>
Dave Nicholas <[email protected]>
Davide Zordan <[email protected]>
Dl Dador <[email protected]>
Edgeware AB <*@edgeware.tv>
Enson Choy <[email protected]>
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Costel Madalin Grecu <[email protected]>
Damien Deis <[email protected]>
Dany L'Hébreux <[email protected]>
Dave Nicholas <[email protected]>
Davide Zordan <[email protected]>
Dl Dador <[email protected]>
Donato Borrello <[email protected]>
Duc Pham <[email protected]>
Expand Down
5 changes: 3 additions & 2 deletions lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -4173,9 +4173,10 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
* @param {string} language
* @param {string=} role
* @param {number=} channelsCount
* @param {number=} safeMargin
* @export
*/
selectAudioLanguage(language, role, channelsCount = 0) {
selectAudioLanguage(language, role, channelsCount = 0, safeMargin = 0) {
const LanguageUtils = shaka.util.LanguageUtils;

if (this.manifest_ && this.playhead_) {
Expand Down Expand Up @@ -4208,7 +4209,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
}
if (bestVariant) {
const track = shaka.util.StreamUtils.variantToTrack(bestVariant);
this.selectVariantTrack(track, /* clearBuffer= */ true);
this.selectVariantTrack(track, /* clearBuffer= */ true, safeMargin);
return;
}

Expand Down