Support playing a video from a specific time (cast from phone, drag a… (#88)

* Support playing a video from a specific time (cast from phone, drag and drop, open in Invidious)

* Remove a console log
This commit is contained in:
Brahim Hadriche authored and GitHub committed 2023-06-25 16:17:12 -04:00
1 parent 6c84630cec
commit 3acf733eec
14 files changed
+220 -45

No files matched your search

@@ -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
@@ -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"
@@ -7,6 +7,7 @@
<field id="chapter" type="string" alias="chapterLabel.text" />
<field id="videoId" type="string" />
<field id="metadata" type="assocarray" />
<field id="timestamp" type="integer" />
</interface>
<children>
<Label