Skip to content

Commit 0655c9d

Browse files
committed
feat: 🎸 (xgplayer-hlsjs) 播放器配置适配hls.js fixed #1664
1 parent 67194ee commit 0655c9d

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

packages/xgplayer-hls.js/src/index.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,23 @@ class HlsJsPlugin extends BasePlugin {
2525
this.player.handleSource = false // 关闭player源处理
2626
}
2727

28+
/**
29+
* @private
30+
*/
31+
_adaptHlsJsConfig (hlsOpts = {}) {
32+
const { playerConfig } = this
33+
34+
if (!hlsOpts?.startPosition && typeof playerConfig.startTime === 'number') {
35+
hlsOpts.startPosition = playerConfig.startTime
36+
}
37+
38+
return hlsOpts
39+
}
40+
2841
afterCreate () {
2942
const { hlsOpts } = this.config
30-
this.hlsOpts = hlsOpts
43+
this.hlsOpts = this._adaptHlsJsConfig(hlsOpts)
44+
3145
this.on(Events.URL_CHANGE, (url) => {
3246
if (/^blob/.test(url)) {
3347
return

0 commit comments

Comments
 (0)