Updated frame-by-frame function to cover previous edge cases. (#1411)

* Updated frame-by-frame function to cover previous edge cases.

* Minor change to setting fps value.

* Fixed default value and if.
This commit is contained in:
Hiers 2021-10-07 11:44:39 +00:00 committed by GitHub
parent 29026765f4
commit eb0138e131
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 6 deletions

View File

@ -865,18 +865,23 @@ export default Vue.extend({
framebyframe: function (step) { framebyframe: function (step) {
this.player.pause() this.player.pause()
const qualityHeight = this.useDash ? this.player.qualityLevels()[this.player.qualityLevels().selectedIndex].height : 0 const quality = this.useDash ? this.player.qualityLevels()[this.player.qualityLevels().selectedIndex] : {}
let fps let fps = 30
// Non-Dash formats are 30fps only // Non-Dash formats are 30fps only
if (qualityHeight >= 480 && this.maxFramerate === 60) { if (this.maxFramerate === 60 && quality.height >= 480) {
fps = 60 for (let i = 0; i < this.adaptiveFormats.length; i++) {
} else { if (this.adaptiveFormats[i].bitrate === quality.bitrate) {
fps = 30 fps = this.adaptiveFormats[i].fps
break
}
}
} }
// The 3 lines below were taken from the videojs-framebyframe node module by Helena Rasche // The 3 lines below were taken from the videojs-framebyframe node module by Helena Rasche
const frameTime = 1 / fps const frameTime = 1 / fps
const dist = frameTime * step const dist = frameTime * step
this.player.currentTime(this.player.currentTime() + dist) this.player.currentTime(this.player.currentTime() + dist)
console.log(fps)
}, },
changeVolume: function (volume) { changeVolume: function (volume) {