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-7101): expose engine and stream type as API #120

Merged
merged 3 commits into from
Sep 25, 2017
Merged
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
30 changes: 30 additions & 0 deletions src/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,18 @@ export default class Player extends FakeEventTarget {
* @private
*/
_env: Object;
/**
* The currently selected engine type
* @type {string}
* @private
*/
_engineType: string;
/**
* The currently selected stream type
* @type {string}
* @private
*/
_streamType: string;

/**
* @param {Object} config - The configuration for the player instance.
Expand Down Expand Up @@ -300,6 +312,8 @@ export default class Player extends FakeEventTarget {
const source = formatSources[0];
if (engine.canPlaySource(source, preferNative[format])) {
Player._logger.debug('Source selected: ', formatSources);
this._engineType = engineId;
this._streamType = format;
this._loadEngine(engine, source);
this.dispatchEvent(new FakeEvent(CustomEvents.SOURCE_SELECTED, {selectedSource: formatSources}));
return true;
Expand Down Expand Up @@ -985,5 +999,21 @@ export default class Player extends FakeEventTarget {
return TrackTypes;
}

/**
* get the engine type
* @returns {string} - html5
*/
get engineType(): ?string {
return this._engineType;
}

/**
* get the stream type
* @returns {string} - hls|dash|progressive
*/
get streamType(): ?string {
return this._streamType;
}

// </editor-fold>
}