diff --git a/src/plugins/mpvAudioPlayer/plugin.js b/src/plugins/mpvAudioPlayer/plugin.js index def917e080..27da7313a3 100644 --- a/src/plugins/mpvAudioPlayer/plugin.js +++ b/src/plugins/mpvAudioPlayer/plugin.js @@ -113,7 +113,7 @@ class HtmlAudioPlayer { self.api.player.load(val, { startMilliseconds: ms, autoplay: true }, - {type: 'music', headers: {'User-Agent': 'JellyfinMediaPlayer'}, frameRate: 0, media: {}}, + {type: 'music', headers: {'User-Agent': 'JellyfinMediaPlayer'}, media: {}}, '#1', '', resolve); diff --git a/src/plugins/mpvVideoPlayer/plugin.js b/src/plugins/mpvVideoPlayer/plugin.js index 0980cab3e2..7abb66537e 100644 --- a/src/plugins/mpvVideoPlayer/plugin.js +++ b/src/plugins/mpvVideoPlayer/plugin.js @@ -189,6 +189,16 @@ async function getApi() { return '#' + this.#subtitleTrackIndexToSetOnPlaying; } + tryGetFramerate(options) { + if (options.mediaSource && options.mediaSource.MediaStreams) { + for (let stream of options.mediaSource.MediaStreams) { + if (stream.Type == "Video") { + return stream.RealFrameRate || stream.AverageFrameRate || null; + } + } + } + } + /** * @private */ @@ -204,10 +214,16 @@ async function getApi() { this.#subtitleTrackIndexToSetOnPlaying = options.mediaSource.DefaultSubtitleStreamIndex == null ? -1 : options.mediaSource.DefaultSubtitleStreamIndex; this.#audioTrackIndexToSetOnPlaying = options.playMethod === 'Transcode' ? null : options.mediaSource.DefaultAudioStreamIndex; + const streamdata = {type: 'video', headers: {'User-Agent': 'JellyfinMediaPlayer'}, media: {}}; + const fps = this.tryGetFramerate(options); + if (fps) { + streamdata.frameRate = fps; + } + const player = this.#api.player; player.load(val, { startMilliseconds: ms, autoplay: true }, - {type: 'video', headers: {'User-Agent': 'JellyfinMediaPlayer'}, frameRate: 0, media: {}}, + streamdata, (this.#audioTrackIndexToSetOnPlaying != null) ? '#' + this.#audioTrackIndexToSetOnPlaying : '#1', this.getSubtitleParam(),