Skip to content

Commit

Permalink
Fix: Resolved issue for switching audio tracks
Browse files Browse the repository at this point in the history
- Added logic to stop `LoadMetaDataTask` before reusing it to prevent potential conflicts.
- Improved comments for clarity on metadata task configuration and execution.
  • Loading branch information
F0x1 committed Dec 14, 2024
1 parent 7fa74bd commit 6f19f27
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion components/video/VideoPlayerView.bs
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,17 @@ sub onAudioIndexChange()
' Save the current video position
m.global.queueManager.callFunc("setTopStartingPoint", int(m.top.position) * 10000000&)

m.top.control = "stop"
' Ensure metadata task is stopped before reusing
if m.LoadMetaDataTask.control = "RUN"
m.LoadMetaDataTask.control = "STOP"
end if

' Configure metadata task with updated audio index
m.LoadMetaDataTask.selectedSubtitleIndex = m.top.SelectedSubtitle
m.LoadMetaDataTask.selectedAudioStreamIndex = m.top.audioIndex
m.LoadMetaDataTask.itemId = m.currentItem.id

' Observe content and start task
m.LoadMetaDataTask.observeField("content", "onVideoContentLoaded")
m.LoadMetaDataTask.control = "RUN"
end sub
Expand Down

0 comments on commit 6f19f27

Please sign in to comment.