Skip to content

Commit

Permalink
feat(player): Added new configuration element to set initial volume o…
Browse files Browse the repository at this point in the history
…n media
  • Loading branch information
rafa8626 committed Dec 18, 2018
1 parent d1953f1 commit a3334e2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ var player = new OpenPlayer('[player ID]', [valid VAST/VPAID URL|List of VAST/VP
// Number of seconds to rewind/forward media
// (by default, player will rewind/forward 5% of the total duration of media)
step,
// Initial volume of media in decimal numbers (by default, `1`)
startVolume,
ads: {
// Custom path/URL to IMA SDK
url,
Expand Down
4 changes: 3 additions & 1 deletion dist/openplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,7 @@ var Player = function () {
volumeControl: 'Volume Control',
volumeSlider: 'Volume Slider'
},
startVolume: 1,
step: 0
};
this.element = element instanceof HTMLMediaElement ? element : document.getElementById(element);
Expand All @@ -1378,8 +1379,9 @@ var Player = function () {
this.ads = ads;
this.fill = fill;
this.autoplay = this.element.autoplay || false;
this.volume = this.element.volume;
this.options = deepmerge(this.defaultOptions, options || {});
this.element.volume = this.options.startVolume;
this.volume = this.element.volume;
this.element.autoplay = false;
}

Expand Down
2 changes: 1 addition & 1 deletion dist/openplayer.min.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/js/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ class Player {
volumeControl: 'Volume Control',
volumeSlider: 'Volume Slider',
},
startVolume: 1,
step: 0,
};

Expand All @@ -272,8 +273,9 @@ class Player {
this.ads = ads;
this.fill = fill;
this.autoplay = this.element.autoplay || false;
this.volume = this.element.volume;
this.options = deepmerge(this.defaultOptions, options || {});
this.element.volume = this.options.startVolume;
this.volume = this.element.volume;
this.element.autoplay = false;
}
return this;
Expand Down

0 comments on commit a3334e2

Please sign in to comment.