|
92 | 92 | video.length = meta.json.MediaSources[0].RunTimeTicks / 10000000 |
93 | 93 | end if |
94 | 94 | end if |
95 | | - if isValid(meta.json.MediaSources[0]) and isValid(meta.json.MediaSources[0].MediaStreams[0]) |
96 | | - video.MaxVideoDecodeResolution = [meta.json.MediaSources[0].MediaStreams[0].Width, meta.json.MediaSources[0].MediaStreams[0].Height] |
| 95 | + ' Find first video stream - MediaStreams[0] might be subtitle/audio |
| 96 | + if isValid(meta.json.MediaSources[0]) and isValid(meta.json.MediaSources[0].MediaStreams) |
| 97 | + videoStream = getFirstVideoStream(meta.json.MediaSources[0].MediaStreams) |
| 98 | + if isValid(videoStream) and isValid(videoStream.Width) and isValid(videoStream.Height) |
| 99 | + video.MaxVideoDecodeResolution = [videoStream.Width, videoStream.Height] |
| 100 | + end if |
97 | 101 | end if |
98 | 102 |
|
99 | 103 | subtitle_idx = m.top.selectedSubtitleIndex |
|
240 | 244 | ' transcode is that the Encoding Level is not supported, then try to direct play but silently |
241 | 245 | ' fall back to the transcode if that fails. |
242 | 246 | if m.playbackInfo.MediaSources[0].MediaStreams.Count() > 0 and meta.live = false |
243 | | - tryDirectPlay = userSettings.playbackTryDirectH264ProfileLevel and m.playbackInfo.MediaSources[0].MediaStreams[0].codec = "h264" |
244 | | - tryDirectPlay = tryDirectPlay or (userSettings.playbackTryDirectHevcProfileLevel and m.playbackInfo.MediaSources[0].MediaStreams[0].codec = "hevc") |
| 247 | + ' Find first video stream - MediaStreams[0] might be subtitle/audio |
| 248 | + firstVideoStream = getFirstVideoStream(m.playbackInfo.MediaSources[0].MediaStreams) |
| 249 | + if isValid(firstVideoStream) and isValid(firstVideoStream.codec) |
| 250 | + tryDirectPlay = userSettings.playbackTryDirectH264ProfileLevel and firstVideoStream.codec = "h264" |
| 251 | + tryDirectPlay = tryDirectPlay or (userSettings.playbackTryDirectHevcProfileLevel and firstVideoStream.codec = "hevc") |
| 252 | + else |
| 253 | + tryDirectPlay = false |
| 254 | + end if |
245 | 255 | if tryDirectPlay and isValid(m.playbackInfo.MediaSources[0].TranscodingUrl) and forceTranscoding = false |
246 | 256 | transcodingReasons = getTranscodeReasons(m.playbackInfo.MediaSources[0].TranscodingUrl) |
247 | 257 | if transcodingReasons.Count() = 1 and transcodingReasons[0] = "VideoLevelNotSupported" |
|
0 commit comments