Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable OSD for intro videos #2046

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 35 additions & 49 deletions components/video/VideoPlayerView.bs
Original file line number Diff line number Diff line change
Expand Up @@ -438,13 +438,9 @@ sub onVideoContentLoaded()

populateChapterMenu()

if m.LoadMetaDataTask.isIntro
' Disable trackplay bar for intro videos
m.top.enableTrickPlay = false
else
' Allow custom captions for non intro videos
m.top.allowCaptions = true
end if

' Allow custom captions for all videos including intro videos
m.top.allowCaptions = true

' Allow default subtitles
m.top.unobserveField("selectedSubtitle")
Expand Down Expand Up @@ -825,62 +821,52 @@ function onKeyEvent(key as string, press as boolean) as boolean
if not press then return false

if key = "down" and not m.top.trickPlayBar.visible
if not m.LoadMetaDataTask.isIntro
' Don't allow user to open menu prior to video loading
if not stateAllowsOSD() then return true
' Don't allow user to open menu prior to video loading
if not stateAllowsOSD() then return true

m.osd.visible = true
m.osd.hasFocus = true
m.osd.setFocus(true)
return true
end if
m.osd.visible = true
m.osd.hasFocus = true
m.osd.setFocus(true)
return true

else if key = "up" and not m.top.trickPlayBar.visible
if not m.LoadMetaDataTask.isIntro
' Don't allow user to open menu prior to video loading
if not stateAllowsOSD() then return true
' Don't allow user to open menu prior to video loading
if not stateAllowsOSD() then return true

m.osd.visible = true
m.osd.hasFocus = true
m.osd.setFocus(true)
return true
end if
m.osd.visible = true
m.osd.hasFocus = true
m.osd.setFocus(true)
return true

else if key = "OK" and not m.top.trickPlayBar.visible
if not m.LoadMetaDataTask.isIntro
' Don't allow user to open menu prior to video loading
if not stateAllowsOSD() then return true

' Show OSD, but don't pause video
m.osd.visible = true
m.osd.hasFocus = true
m.osd.setFocus(true)
return true
end if
' Don't allow user to open menu prior to video loading
if not stateAllowsOSD() then return true

return false
' Show OSD, but don't pause video
m.osd.visible = true
m.osd.hasFocus = true
m.osd.setFocus(true)
return true
end if

' Disable OSD for intro videos
if not m.LoadMetaDataTask.isIntro
if key = "play" and not m.top.trickPlayBar.visible

' Don't allow user to open menu prior to video loading
if not stateAllowsOSD() then return true
if key = "play" and not m.top.trickPlayBar.visible

' If video is paused, resume it and don't show OSD
if m.top.state = "paused"
m.top.control = "resume"
return true
end if
' Don't allow user to open menu prior to video loading
if not stateAllowsOSD() then return true

' Pause video and show OSD
m.top.control = "pause"
m.osd.visible = true
m.osd.hasFocus = true
m.osd.setFocus(true)
' If video is paused, resume it and don't show OSD
if m.top.state = "paused"
m.top.control = "resume"
return true
end if

' Pause video and show OSD
m.top.control = "pause"
m.osd.visible = true
m.osd.hasFocus = true
m.osd.setFocus(true)
return true
end if

if key = "back"
Expand Down
Loading