Skip to content

Commit

Permalink
Merge pull request #136 from vlitejs/fix/duration-with-preload-none
Browse files Browse the repository at this point in the history
Fix duration when preload is disabled
  • Loading branch information
yoriiis authored Aug 27, 2024
2 parents 116f0b2 + 66e7754 commit 11a7b20
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## 6.0.4

### Fixes

- Fix duration when preload is disabled ([#136](https://github.com/vlitejs/vlite/pull/136))

## 6.0.3

### Fixes
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vlitejs",
"version": "6.0.3",
"version": "6.0.4",
"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)",
"keywords": [
"video",
Expand Down
15 changes: 12 additions & 3 deletions src/core/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,22 @@ export default class Player {

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

// Call the onReady functions of components
if (this.media.preload === 'none' && this.Vlitejs.provider === 'html5') {
this.media.addEventListener('loadedmetadata', () => this.triggerOnReady())
} else {
this.triggerOnReady()
}
this.loading(false)
}

/**
* Trigger on ready component's functions
*/
triggerOnReady() {
this.options.controls && this.controlBar.onReady()
Object.keys(this.plugins).forEach((id) => {
this.plugins[id].onReady instanceof Function && this.plugins[id].onReady()
})

this.loading(false)
}

/**
Expand Down

0 comments on commit 11a7b20

Please sign in to comment.