Pause/Resume during picture in picture (#156)

* Pause/Resume during picture in picture

* changelog

* changelog
This commit is contained in:
Brahim Hadriche authored and GitHub committed 2023-10-02 15:14:24 -04:00
1 parent a6f8cb59ee
commit 324543684d
3 files changed
+34 -1

No files matched your search

+6
View File
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added
- Support to pause/play while picture-in-picture
## [0.13.0] - 2023-10-02
### Added
@@ -83,7 +83,22 @@ function onKeyEvent(key as string, press as boolean) as boolean
end if
if key = "options"
VideoUtils.ToggleVideoPictureInPicture()
else if key = "back"
return true
end if
if key = "play"
VideoUtils.TogglePause()
end if
if key = "pause"
VideoUtils.PauseVideo()
end if
if key = "playonly"
VideoUtils.ResumeVideo()
end if
if key = "back"
dialog = DialogUtils.ShowDialogButtons("Do you want to exit Playlet?", "Exit", ["Exit", "Cancel"])
dialog.observeField("buttonSelected", FuncName(OnExitDialog), ["buttonSelected"])
return true
@@ -81,6 +81,18 @@ namespace VideoUtils
player.control = "resume"
end function
function TogglePause() as void
player = GetVideoPlayer()
if player = invalid
return
end if
if player.state = "playing"
player.control = "pause"
else if player.state = "paused"
player.control = "resume"
end if
end function
end namespace