Skip to content

Commit

Permalink
feat: support full webOS mediaOption object (#736)
Browse files Browse the repository at this point in the history
if useMediaOptionAttribute is true then first take all mediaOptionAttribute which is an object that passes as is the webLG options as defined in https://webostv.developer.lge.com/develop/guides/mediaoption-parameter
If abrEwmaDefaultEstimate is defined so it passes it as override on top of the mediaOption in the 'option.adaptiveStreaming.bps' object
  • Loading branch information
OrenMe authored Nov 29, 2023
1 parent 7dea414 commit 54f78a0
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/engines/html5/media-source/adapters/native-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,13 +467,25 @@ export default class NativeAdapter extends BaseMediaSourceAdapter {
source.setAttribute('type', mimetype);

if (this._config.useMediaOptionAttribute) {
const options = {};
options.option = {};
let options = {};
// https://webostv.developer.lge.com/develop/guides/mediaoption-parameter
if (this._config.mediaOptionAttribute) {
/**
* Undocumented option.
* Usage example:
* var video = document.querySelector('video');
* video.addEventListener("umsmediainfo", function(e) {
* console.log(JSON.parse(e.detail));
* });
* {
* useUMSMediaInfo: true
* }
**/
options = this._config.mediaOptionAttribute;
}
if (this._config.abrEwmaDefaultEstimate) {
options.option.adaptiveStreaming = {};
options.option.adaptiveStreaming.bps = {
start: this._config.abrEwmaDefaultEstimate
};
const bps = {start: this._config.abrEwmaDefaultEstimate};
Utils.Object.createPropertyPath(options, 'option.adaptiveStreaming.bps', bps);
}
NativeAdapter._logger.debug('Setting mediaOption -', options);
const mediaOption = encodeURI(JSON.stringify(options));
Expand Down

0 comments on commit 54f78a0

Please sign in to comment.