From eb0138e131293f86159fd7a2a784ca9b5af3ab3d Mon Sep 17 00:00:00 2001 From: Hiers <47784553+Hiers@users.noreply.github.com> Date: Thu, 7 Oct 2021 11:44:39 +0000 Subject: [PATCH] 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. --- .../ft-video-player/ft-video-player.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/renderer/components/ft-video-player/ft-video-player.js b/src/renderer/components/ft-video-player/ft-video-player.js index da990e87..06907958 100644 --- a/src/renderer/components/ft-video-player/ft-video-player.js +++ b/src/renderer/components/ft-video-player/ft-video-player.js @@ -865,18 +865,23 @@ export default Vue.extend({ framebyframe: function (step) { this.player.pause() - const qualityHeight = this.useDash ? this.player.qualityLevels()[this.player.qualityLevels().selectedIndex].height : 0 - let fps + const quality = this.useDash ? this.player.qualityLevels()[this.player.qualityLevels().selectedIndex] : {} + let fps = 30 // Non-Dash formats are 30fps only - if (qualityHeight >= 480 && this.maxFramerate === 60) { - fps = 60 - } else { - fps = 30 + if (this.maxFramerate === 60 && quality.height >= 480) { + for (let i = 0; i < this.adaptiveFormats.length; i++) { + if (this.adaptiveFormats[i].bitrate === quality.bitrate) { + fps = this.adaptiveFormats[i].fps + break + } + } } + // The 3 lines below were taken from the videojs-framebyframe node module by Helena Rasche const frameTime = 1 / fps const dist = frameTime * step this.player.currentTime(this.player.currentTime() + dist) + console.log(fps) }, changeVolume: function (volume) {