Skip to content

Commit

Permalink
fix(FEC-7034): player gets stuck at the end after replay - ie11 (#49)
Browse files Browse the repository at this point in the history
upgrade shaka to 2.3.3 for shaka-project/shaka-player#979 fix
fix shaka v2.3.3 text tracks issue (hidden text tracks not handled see shaka-project/shaka-player#1058) by custom text displayer
  • Loading branch information
yairans committed Mar 7, 2018
1 parent 5bf0975 commit c8943bd
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"mocha": "^3.2.0",
"mocha-cli": "^1.0.1",
"playkit-js": "https://github.com/kaltura/playkit-js.git#v0.21.5",
"shaka-player": "2.2.2",
"shaka-player": "2.3.3",
"sinon": "^2.0.0",
"sinon-chai": "^2.8.0",
"standard-version": "^4.0.0",
Expand All @@ -66,7 +66,7 @@
"license": "AGPL-3.0",
"peerDependencies": {
"playkit-js": "https://github.com/kaltura/playkit-js.git#v0.21.5",
"shaka-player": "2.2.2"
"shaka-player": "2.3.3"
},
"repository": {
"type": "git",
Expand Down
18 changes: 16 additions & 2 deletions src/dash-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {Error} from 'playkit-js'
import Widevine from './drm/widevine'
import PlayReady from './drm/playready'
import DefaultConfig from './default-config'
import TextDisplayer from './text-displayer'
import {EventType} from 'playkit-js'

type ShakaEventType = { [event: string]: string };
Expand Down Expand Up @@ -202,7 +203,21 @@ export default class DashAdapter extends BaseMediaSourceAdapter {
constructor(videoElement: HTMLVideoElement, source: PKMediaSourceObject, config: Object = {}) {
DashAdapter._logger.debug('Creating adapter. Shaka version: ' + shaka.Player.version);
super(videoElement, source, config);
this._config = Utils.Object.mergeDeep({}, this._config, DefaultConfig);
this._setShakaConfig();
}

/**
* Sets the shaka config.
* @private
* @returns {void}
*/
_setShakaConfig(): void {
const textDisplayerConfig = {
textDisplayFactory: function (videoEl) {
return new TextDisplayer(videoEl);
}.bind(null, this._videoElement)
};
this._config = Utils.Object.mergeDeep(textDisplayerConfig, this._config, DefaultConfig);
}

/**
Expand Down Expand Up @@ -483,7 +498,6 @@ export default class DashAdapter extends BaseMediaSourceAdapter {
selectTextTrack(textTrack: TextTrack): void {
if (this._shaka && (textTrack instanceof TextTrack) && !textTrack.active && (textTrack.kind === 'subtitles' || textTrack.kind === 'captions')) {
this._shaka.selectTextLanguage(textTrack.language);
this._shaka.setTextTrackVisibility(false);
this._onTrackChanged(textTrack);
}
}
Expand Down
17 changes: 17 additions & 0 deletions src/text-displayer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// @flow
import shaka from 'shaka-player';

/**
* shaka doesn't handle hidden caption see https://github.com/google/shaka-player/issues/1058.
* This stops us to handle the caption by ourself by setting the native caption hidden.
* So we have to override the shaka text displayer to cause shaka handles hidden caption.
*/
export default class TextDisplayer extends shaka.text.SimpleTextDisplayer {
/**
*
* @return {boolean} - isTextVisible
*/
isTextVisible(): boolean {
return true;
}
}
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4301,9 +4301,9 @@ sha.js@^2.4.0, sha.js@^2.4.8:
dependencies:
inherits "^2.0.1"

shaka-player@2.2.2:
version "2.2.2"
resolved "https://registry.yarnpkg.com/shaka-player/-/shaka-player-2.2.2.tgz#9f0d234999486892be4eff90911498d0d735e316"
shaka-player@2.3.3:
version "2.3.3"
resolved "https://registry.yarnpkg.com/shaka-player/-/shaka-player-2.3.3.tgz#ea1e62df834300eea0727b1cf93649a252a24d03"

shebang-command@^1.2.0:
version "1.2.0"
Expand Down

0 comments on commit c8943bd

Please sign in to comment.