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(FEC-10941): Use In-Stream DASH thumbnails on the timeline #550

Merged
merged 3 commits into from
Mar 14, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 2 additions & 0 deletions flow-typed/interfaces/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import AudioTrack from '../../src/track/audio-track';
import TextTrack from '../../src/track/text-track';
import FakeEventTarget from '../../src/event/fake-event-target';
import {ThumbnailInfo} from '../../src/thumbnail/thumbnail-info';
import {ImageTrack} from '../../src/playkit';

declare interface IEngineStatic {
id: string;
Expand All @@ -28,6 +29,7 @@ declare interface IEngine extends FakeEventTarget {
selectVideoTrack(videoTrack: VideoTrack): void;
selectAudioTrack(audioTrack: AudioTrack): void;
selectTextTrack(textTrack: TextTrack): void;
selectImageTrack(imageTrack: ImageTrack): void;
isPictureInPictureSupported(): boolean;
enterPictureInPicture(): void;
exitPictureInPicture(): void;
Expand Down
3 changes: 2 additions & 1 deletion flow-typed/interfaces/media-source-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import VideoTrack from '../../src/track/video-track';
import AudioTrack from '../../src/track/audio-track';
import TextTrack from '../../src/track/text-track';
import {FakeEventTarget} from '../../src/playkit';
import {FakeEventTarget, ImageTrack} from '../../src/playkit';

declare interface IMediaSourceAdapterStatic {
+id: string;
Expand All @@ -24,6 +24,7 @@ declare interface IMediaSourceAdapter extends FakeEventTarget {
selectVideoTrack(videoTrack: VideoTrack): void;
selectAudioTrack(audioTrack: AudioTrack): void;
selectTextTrack(textTrack: TextTrack): void;
selectImageTrack(imageTrack: ImageTrack): void;
hideTextTrack(): void;
enableAdaptiveBitrate(): void;
isAdaptiveBitrateEnabled(): boolean;
Expand Down
12 changes: 12 additions & 0 deletions src/engines/html5/html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import MediaSourceProvider from './media-source/media-source-provider';
import VideoTrack from '../../track/video-track';
import AudioTrack from '../../track/audio-track';
import PKTextTrack from '../../track/text-track';
import ImageTrack from '../../track/image-track';
import {Cue} from '../../track/vtt-cue';
import * as Utils from '../../utils/util';
import Html5AutoPlayCapability from './capabilities/html5-autoplay';
Expand Down Expand Up @@ -392,6 +393,17 @@ export default class Html5 extends FakeEventTarget implements IEngine {
this._addCueChangeListener();
}

/**
* Select a new image track.
* @param {ImageTrack} imageTrack - The image track object to set.
* @returns {void}
*/
selectImageTrack(imageTrack: ImageTrack): void {
if (this._mediaSourceAdapter) {
this._mediaSourceAdapter.selectImageTrack(imageTrack);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to add to base-media-source-adapter to not crash on hls or native

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
}

/**
* Hide the text track
* @function hideTextTrack
Expand Down
2 changes: 2 additions & 0 deletions src/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,8 @@ export default class Player extends FakeEventTarget {
this._externalCaptionsHandler.hideTextTrack();
this._engine.selectTextTrack(track);
}
} else if (track instanceof ImageTrack) {
this._engine.selectImageTrack(track);
}
}
}
Expand Down