Maximize video if playing on channel exit

This commit is contained in:
Brahim Hadriche committed 2023-10-27 13:22:06 -04:00
1 parent 53f8535535
commit 97592f9839
2 files changed
+28 -11

No files matched your search

@@ -82,23 +82,35 @@ function onKeyEvent(key as string, press as boolean) as boolean
return false return false
end if end if
if key = "options" if key = "options"
VideoUtils.ToggleVideoPictureInPicture() if VideoUtils.ToggleVideoPictureInPicture()
return true return true
end if
end if end if
if key = "play" if key = "play"
VideoUtils.TogglePause() if VideoUtils.TogglePause()
return true
end if
end if end if
if key = "pause" if key = "pause"
VideoUtils.PauseVideo() if VideoUtils.PauseVideo()
return true
end if
end if end if
if key = "playonly" if key = "playonly"
VideoUtils.ResumeVideo() if VideoUtils.ResumeVideo()
return true
end if
end if end if
if key = "back" if key = "back"
if VideoUtils.IsVideoPlayerOpen() and not VideoUtils.IsVideoPlayerFullScreen()
if VideoUtils.ToggleVideoPictureInPicture()
return true
end if
end if
dialog = DialogUtils.ShowDialogButtons("Do you want to exit Playlet?", "Exit", ["Exit", "Cancel"]) dialog = DialogUtils.ShowDialogButtons("Do you want to exit Playlet?", "Exit", ["Exit", "Cancel"])
dialog.observeField("buttonSelected", FuncName(OnExitDialog), ["buttonSelected"]) dialog.observeField("buttonSelected", FuncName(OnExitDialog), ["buttonSelected"])
return true return true
@@ -85,32 +85,37 @@ namespace VideoUtils
return GetVideoPlayer() <> invalid return GetVideoPlayer() <> invalid
end function end function
function PauseVideo() as void function PauseVideo() as boolean
player = GetVideoPlayer() player = GetVideoPlayer()
if player = invalid if player = invalid
return return false
end if end if
player.control = "pause" player.control = "pause"
return true
end function end function
function ResumeVideo() as void function ResumeVideo() as boolean
player = GetVideoPlayer() player = GetVideoPlayer()
if player = invalid if player = invalid
return return false
end if end if
player.control = "resume" player.control = "resume"
return true
end function end function
function TogglePause() as void function TogglePause() as boolean
player = GetVideoPlayer() player = GetVideoPlayer()
if player = invalid if player = invalid
return return false
end if end if
if player.state = "playing" if player.state = "playing"
player.control = "pause" player.control = "pause"
return true
else if player.state = "paused" else if player.state = "paused"
player.control = "resume" player.control = "resume"
return true
end if end if
return false
end function end function
end namespace end namespace