Skip to content

Commit

Permalink
Pause/Resume during picture in picture (#156)
Browse files Browse the repository at this point in the history
* Pause/Resume during picture in picture

* changelog

* changelog
  • Loading branch information
iBicha authored Oct 2, 2023
1 parent a6f8cb5 commit 3245436
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 16 additions & 1 deletion playlet-lib/src/components/AppController/AppController.bs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions playlet-lib/src/components/VideoPlayer/VideoUtils.bs
Original file line number Diff line number Diff line change
Expand Up @@ -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


0 comments on commit 3245436

Please sign in to comment.