Skip to content

Commit

Permalink
fix(xgplayer-hls.js): support videoInit
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangxin92 committed Jul 30, 2021
1 parent 9a12490 commit bc079a8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/xgplayer-hls.js/browser/index.js

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions packages/xgplayer-hls.js/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1889,9 +1889,11 @@ var HlsJsPlayer = function (_Player) {
_this.register(_this.config.url);
_this.once('complete', function () {
hls.attachMedia(player.video);
player.once('canplay', function () {
player.play().catch(function (err) {});
});
if (!player.config.videoInit) {
player.once('canplay', function () {
player.play().catch(function (err) {});
});
}
});
_this.once('destroy', function () {
hls.stopLoad();
Expand Down
2 changes: 1 addition & 1 deletion packages/xgplayer-hls.js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xgplayer-hls.js",
"version": "2.5.1",
"version": "2.5.2",
"description": "xgplayer plugin for hls",
"main": "./dist/index.js",
"scripts": {
Expand Down
8 changes: 5 additions & 3 deletions packages/xgplayer-hls.js/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,11 @@ class HlsJsPlayer extends Player {
this.register(this.config.url)
this.once('complete', () => {
hls.attachMedia(player.video)
player.once('canplay', () => {
player.play().catch(err => {})
})
if(!player.config.videoInit) {
player.once('canplay', () => {
player.play().catch(err => {})
})
}
})
this.once('destroy', () => {
hls.stopLoad()
Expand Down

0 comments on commit bc079a8

Please sign in to comment.