Skip to content

Commit 4d5587d

Browse files
committed
Update code docs
1 parent 3c3da15 commit 4d5587d

2 files changed

Lines changed: 17 additions & 7 deletions

File tree

docs/components_ItemGrid_LoadVideoContentTask.bs.html

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,13 +473,16 @@
473473
return false
474474
end if
475475

476-
if not isValid(meta.json.MediaStreams[0])
476+
' Get the first video stream instead of blindly using MediaStreams[0]
477+
' which could be a subtitle or audio stream
478+
videoStream = getFirstVideoStream(meta.json.MediaStreams)
479+
if not isValid(videoStream)
477480
return false
478481
end if
479482

480-
streamInfo = { Codec: meta.json.MediaStreams[0].codec }
481-
if isValid(meta.json.MediaStreams[0].Profile) and meta.json.MediaStreams[0].Profile.len() > 0
482-
streamInfo.Profile = LCase(meta.json.MediaStreams[0].Profile)
483+
streamInfo = { Codec: videoStream.codec }
484+
if isValid(videoStream.Profile) and videoStream.Profile.len() > 0
485+
streamInfo.Profile = LCase(videoStream.Profile)
483486
end if
484487
if isValid(meta.json.MediaSources[0].container) and meta.json.MediaSources[0].container.len() > 0
485488
'CanDecodeVideo() requires the .container to be format: “mp4”, “hls”, “mkv”, “ism”, “dash”, “ts” if its to direct stream

docs/source_VideoPlayer.bs.html

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,16 @@
396396
return false
397397
end if
398398

399-
streamInfo = { Codec: meta.json.MediaStreams[0].codec }
400-
if isValid(meta.json.MediaStreams[0].Profile) and meta.json.MediaStreams[0].Profile.len() > 0
401-
streamInfo.Profile = LCase(meta.json.MediaStreams[0].Profile)
399+
' Get the first video stream instead of blindly using MediaStreams[0]
400+
' which could be a subtitle or audio stream
401+
videoStream = getFirstVideoStream(meta.json.MediaStreams)
402+
if not isValid(videoStream)
403+
return false
404+
end if
405+
406+
streamInfo = { Codec: videoStream.codec }
407+
if isValid(videoStream.Profile) and videoStream.Profile.len() > 0
408+
streamInfo.Profile = LCase(videoStream.Profile)
402409
end if
403410
if isValid(meta.json.MediaSources[0].container) and meta.json.MediaSources[0].container.len() > 0
404411
'CanDecodeVideo() requires the .container to be format: “mp4”, “hls”, “mkv”, “ism”, “dash”, “ts” if its to direct stream

0 commit comments

Comments
 (0)