New option: preload
This commit is contained in:
parent
60d90b1737
commit
e626eceea9
|
|
@ -50,6 +50,7 @@ var option = {
|
|||
lang: 'zh', // Optional, language, `zh` for Chinese, `en` for English, default: Navigator language
|
||||
screenshot: true, // Optional, enable screenshot function, default: false, NOTICE: if set it to true, video and video poster must enable Cross-Origin
|
||||
hotkey: true, // Optional, binding hot key, including left right and Space, default: true
|
||||
preload: 'auto', // Optional, the way to load music, can be 'none' 'metadata' 'auto', default: 'auto'
|
||||
video: { // Required, video info
|
||||
url: '若能绽放光芒.mp4', // Required, video url
|
||||
pic: '若能绽放光芒.png' // Optional, music picture
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -49,7 +49,8 @@ class DPlayer {
|
|||
loop: false,
|
||||
lang: navigator.language.indexOf('zh') !== -1 ? 'zh' : 'en',
|
||||
screenshot: false,
|
||||
hotkey: true
|
||||
hotkey: true,
|
||||
preload: 'auto'
|
||||
};
|
||||
for (let defaultKey in defaultOption) {
|
||||
if (defaultOption.hasOwnProperty(defaultKey) && !option.hasOwnProperty(defaultKey)) {
|
||||
|
|
@ -117,7 +118,7 @@ class DPlayer {
|
|||
this.element.innerHTML = `
|
||||
<div class="dplayer-mask"></div>
|
||||
<div class="dplayer-video-wrap">
|
||||
<video class="dplayer-video" ${option.video.pic ? `poster="${option.video.pic}"` : ``} ${option.screenshot ? `crossorigin="anonymous"` : ``}>
|
||||
<video class="dplayer-video" ${option.video.pic ? `poster="${option.video.pic}"` : ``} ${option.screenshot ? `crossorigin="anonymous"` : ``} preload="${option.preload}">
|
||||
<source src="${option.video.url}">
|
||||
</video>
|
||||
<div class="dplayer-danmaku">
|
||||
|
|
|
|||
Loading…
Reference in New Issue