diff --git a/CHANGELOG.md b/CHANGELOG.md index 55c8cf58..2ab70c62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 playing a video from a specific time (cast from phone, drag and drop, open in Invidious) + ## [0.10.0] - 2023-06-25 ### Added diff --git a/docs/RELEASING.md b/docs/RELEASING.md index 6f5edad5..4b2e60ba 100644 --- a/docs/RELEASING.md +++ b/docs/RELEASING.md @@ -1,3 +1,5 @@ + + # Releasing These are mostly the steps when releasing a new version: diff --git a/docs/unstable-changelog.md b/docs/unstable-changelog.md index ed1101ac..ac46a8ca 100644 --- a/docs/unstable-changelog.md +++ b/docs/unstable-changelog.md @@ -1,3 +1,5 @@ + + This is an automated release. It is generated when new code is pushed to the main branch. To test this release: @@ -6,4 +8,4 @@ To test this release: - Go to settings, and scroll down to `Developer settings` - Set `Playlet Library version` to `unstable` and click `Apply` - Restart Playlet -- You can verify that you're testing the `unstable` release in the `Info` tab in Playlet or the web app \ No newline at end of file +- You can verify that you're testing the `unstable` release in the `Info` tab in Playlet or the web app diff --git a/playlet-lib/src/components/MainScene.bs b/playlet-lib/src/components/MainScene.bs index 6ab17eb3..01aed83c 100644 --- a/playlet-lib/src/components/MainScene.bs +++ b/playlet-lib/src/components/MainScene.bs @@ -113,8 +113,11 @@ function OnWebServerLogin() m.homeGridScreen.refresh = true end function -function OnWebServerCommand() - if m.serverTask.command.StartsWith("play:") +function OnWebServerCommand() as void + if m.serverTask.command = invalid or m.serverTask.command.command = invalid + return + end if + if m.serverTask.command.command = "play" sender = m.videoContainer.sender ?? m.currentFocued if m.videoContainer.fullscreen dialog = m.top.getScene().dialog @@ -122,7 +125,7 @@ function OnWebServerCommand() dialog.close = true end if end if - PlayVideo(m.serverTask.command.Mid(5), { sender: sender }) + PlayVideo(m.serverTask.command.videoId, { sender: sender, timestamp: m.serverTask.command.timestamp }) end if end function @@ -146,5 +149,5 @@ function PlayVideoFromArgs(args as object) as void end if sender = m.videoContainer.sender ?? m.currentFocued - PlayVideo(args.contentId, { sender: sender }) + PlayVideo(args.contentId, { sender: sender, timestamp: args.timestamp }) end function diff --git a/playlet-lib/src/components/VideoPlayer/Video.bs b/playlet-lib/src/components/VideoPlayer/Video.bs index 0a339755..fde2b0ab 100644 --- a/playlet-lib/src/components/VideoPlayer/Video.bs +++ b/playlet-lib/src/components/VideoPlayer/Video.bs @@ -7,11 +7,16 @@ import "pkg:/components/VideoPlayer/MarkVideoWatchedTask.bs" function PlayVideo(videoId as string, args = invalid as object) sender = args?.sender metadata = args?.metadata + timestamp = args?.timestamp if metadata <> invalid and GetInterface(metadata, "ifSGNodeField") <> invalid metadata = args.metadata.getFields() end if + if timestamp = invalid + timestamp = 0 + end if + width = 1280 height = 720 translation = [0.0, 0.0] @@ -29,6 +34,7 @@ function PlayVideo(videoId as string, args = invalid as object) videoContainer.insertChild(videoContainer.videoPlayer, 0) videoContainer.videoPlayer.id = "VideoPlayer" videoContainer.videoPlayer.metadata = metadata + videoContainer.videoPlayer.timestamp = timestamp videoContainer.videoPlayer.videoId = videoId videoContainer.videoPlayer.width = width videoContainer.videoPlayer.height = height diff --git a/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs b/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs index 9f5f4234..75dbee54 100644 --- a/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs +++ b/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs @@ -286,8 +286,11 @@ function OnVideoPlayerStateChange() as void ' If we successfully played the video, then any error that comes later is not due to a 403 (FORBIDDEN). ' This is to reduce false positives, as we do not want retry another link if the first link is working fine. - if state = "playing" + if state = "playing" and not m.videoPlayingSuccess m.videoPlayingSuccess = true + if m.top.timestamp <> 0 + m.top.seek = m.top.timestamp + end if end if if state = "error" diff --git a/playlet-lib/src/components/VideoPlayer/VideoPlayer.xml b/playlet-lib/src/components/VideoPlayer/VideoPlayer.xml index ab11a57f..2e2d4d91 100644 --- a/playlet-lib/src/components/VideoPlayer/VideoPlayer.xml +++ b/playlet-lib/src/components/VideoPlayer/VideoPlayer.xml @@ -7,6 +7,7 @@ +