Skip to content

Commit 11a7b20

Browse files
authored
Merge pull request #136 from vlitejs/fix/duration-with-preload-none
Fix duration when preload is disabled
2 parents 116f0b2 + 66e7754 commit 11a7b20

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# CHANGELOG
22

3+
## 6.0.4
4+
5+
### Fixes
6+
7+
- Fix duration when preload is disabled ([#136](https://github.com/vlitejs/vlite/pull/136))
8+
39
## 6.0.3
410

511
### Fixes

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vlitejs",
3-
"version": "6.0.3",
3+
"version": "6.0.4",
44
"description": "vLitejs is a fast and lightweight Javascript library for customizing video and audio player in Javascript with a minimalist theme (HTML5, Youtube, Vimeo, Dailymotion)",
55
"keywords": [
66
"video",

src/core/player.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,22 @@ export default class Player {
202202

203203
this.Vlitejs.onReady instanceof Function && this.Vlitejs.onReady.call(this, this)
204204

205-
// Call the onReady functions of components
205+
if (this.media.preload === 'none' && this.Vlitejs.provider === 'html5') {
206+
this.media.addEventListener('loadedmetadata', () => this.triggerOnReady())
207+
} else {
208+
this.triggerOnReady()
209+
}
210+
this.loading(false)
211+
}
212+
213+
/**
214+
* Trigger on ready component's functions
215+
*/
216+
triggerOnReady() {
206217
this.options.controls && this.controlBar.onReady()
207218
Object.keys(this.plugins).forEach((id) => {
208219
this.plugins[id].onReady instanceof Function && this.plugins[id].onReady()
209220
})
210-
211-
this.loading(false)
212221
}
213222

214223
/**

0 commit comments

Comments
 (0)