Skip to content

Commit e14f8a5

Browse files
committed
Update code docs
1 parent bf3878f commit e14f8a5

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

docs/components_ItemGrid_LoadVideoContentTask.bs.html

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,12 @@
9292
video.length = meta.json.MediaSources[0].RunTimeTicks / 10000000
9393
end if
9494
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
97101
end if
98102

99103
subtitle_idx = m.top.selectedSubtitleIndex
@@ -240,8 +244,14 @@
240244
' transcode is that the Encoding Level is not supported, then try to direct play but silently
241245
' fall back to the transcode if that fails.
242246
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
245255
if tryDirectPlay and isValid(m.playbackInfo.MediaSources[0].TranscodingUrl) and forceTranscoding = false
246256
transcodingReasons = getTranscodeReasons(m.playbackInfo.MediaSources[0].TranscodingUrl)
247257
if transcodingReasons.Count() = 1 and transcodingReasons[0] = "VideoLevelNotSupported"

0 commit comments

Comments
 (0)