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

fix(FEC-7034): player gets stuck at the end after replay - ie11 #49

Merged
merged 2 commits into from
Mar 7, 2018
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
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