On branch master Send framerate to mpv player.

This commit is contained in:
Ian Walton 2021-04-10 11:32:47 -04:00
parent b67a126468
commit 56574b3516
2 changed files with 18 additions and 2 deletions

View File

@ -113,7 +113,7 @@ class HtmlAudioPlayer {
self.api.player.load(val, self.api.player.load(val,
{ startMilliseconds: ms, autoplay: true }, { startMilliseconds: ms, autoplay: true },
{type: 'music', headers: {'User-Agent': 'JellyfinMediaPlayer'}, frameRate: 0, media: {}}, {type: 'music', headers: {'User-Agent': 'JellyfinMediaPlayer'}, media: {}},
'#1', '#1',
'', '',
resolve); resolve);

View File

@ -189,6 +189,16 @@ async function getApi() {
return '#' + this.#subtitleTrackIndexToSetOnPlaying; 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 * @private
*/ */
@ -204,10 +214,16 @@ async function getApi() {
this.#subtitleTrackIndexToSetOnPlaying = options.mediaSource.DefaultSubtitleStreamIndex == null ? -1 : options.mediaSource.DefaultSubtitleStreamIndex; this.#subtitleTrackIndexToSetOnPlaying = options.mediaSource.DefaultSubtitleStreamIndex == null ? -1 : options.mediaSource.DefaultSubtitleStreamIndex;
this.#audioTrackIndexToSetOnPlaying = options.playMethod === 'Transcode' ? null : options.mediaSource.DefaultAudioStreamIndex; 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; const player = this.#api.player;
player.load(val, player.load(val,
{ startMilliseconds: ms, autoplay: true }, { startMilliseconds: ms, autoplay: true },
{type: 'video', headers: {'User-Agent': 'JellyfinMediaPlayer'}, frameRate: 0, media: {}}, streamdata,
(this.#audioTrackIndexToSetOnPlaying != null) (this.#audioTrackIndexToSetOnPlaying != null)
? '#' + this.#audioTrackIndexToSetOnPlaying : '#1', ? '#' + this.#audioTrackIndexToSetOnPlaying : '#1',
this.getSubtitleParam(), this.getSubtitleParam(),