Skip to content

Commit

Permalink
feat(FEC-7101): expose engine and stream type as API (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrenMe authored and Dan Ziv committed Sep 25, 2017
1 parent 1c0c4e0 commit 58c2e9e
Showing 1 changed file with 30 additions and 0 deletions.
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>
}

0 comments on commit 58c2e9e

Please sign in to comment.