Skip to content

Commit

Permalink
fix(player): Removed resetting of autoplay and expand conditional t…
Browse files Browse the repository at this point in the history
…o test if HLS.js needs to be loaded
  • Loading branch information
rafa8626 committed Dec 18, 2019
1 parent d2bf78b commit 09c3124
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions dist/openplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1531,7 +1531,6 @@ var Player = function () {
}

this.volume = this.element.volume;
this.element.autoplay = false;
}

return this;
Expand Down Expand Up @@ -7397,6 +7396,8 @@ var Media = function () {
value: function _invoke(media) {
var _this4 = this;

var playHLSNatively = this.element.canPlayType('application/vnd.apple.mpegurl') || this.element.canPlayType('application/x-mpegURL');

if (Object.keys(this.customMedia.media).length) {
var customRef;
this.customMedia.rules.forEach(function (rule) {
Expand All @@ -7415,7 +7416,7 @@ var Media = function () {
} else {
return new html5_1["default"](this.element, media);
}
} else if (source.isHlsSource(media)) {
} else if (!playHLSNatively && source.isHlsSource(media)) {
var hlsOptions = this.options && this.options.hls ? this.options.hls : undefined;
return new hls_1["default"](this.element, media, this.autoplay, hlsOptions);
} else if (source.isDashSource(media)) {
Expand Down
2 changes: 1 addition & 1 deletion dist/openplayer.min.js

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/js/media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,9 @@ class Media {
* @memberof Media
*/
private _invoke(media: Source): HlsMedia | DashMedia | HTML5Media | any {
const playHLSNatively = this.element.canPlayType('application/vnd.apple.mpegurl') ||
this.element.canPlayType('application/x-mpegURL');

if (Object.keys(this.customMedia.media).length) {
let customRef: any;
this.customMedia.rules.forEach((rule: any) => {
Expand All @@ -521,7 +524,7 @@ class Media {
} else {
return new HTML5Media(this.element, media);
}
} else if (source.isHlsSource(media)) {
} else if (!playHLSNatively && source.isHlsSource(media)) {
const hlsOptions = this.options && this.options.hls ? this.options.hls : undefined;
return new HlsMedia(this.element, media, this.autoplay, hlsOptions);
} else if (source.isDashSource(media)) {
Expand Down
1 change: 0 additions & 1 deletion src/js/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ class Player {
this.element.currentTime = this.options.startTime;
}
this.volume = this.element.volume;
this.element.autoplay = false;
}
return this;
}
Expand Down

0 comments on commit 09c3124

Please sign in to comment.