Cast using Youtube app (DIAL/LoungeAPI) (#276)
* Dial+Lounge API PoC * format * Fix for chrome * comments * Rate limit and logger stuff * rename route * remove invalid routes * remove device image * Simplify device description * command test * Lint fix * register pairing code * tv code UI * Lint fix * Avoid creating lots of objects * dpad command * small refactor * tweak * validation * timer * fix * Revert "timer" This reverts commit e349565910882408898c9bddda55dadaa9d743de. * Commands * setVolume command * lounge service timer * Some state messages * Lint fix * player state sync * voice handler * Adjustments, and add a TODO list * Lint fix * comment * play at timestamp * Remote screen UI * UI adjustment * Small refactor * Refactor long polling * Add TODO * Manage logging a bit better to avoid spam in DIAL server * cache dial file * logging * comment * Join lounge lazily * long poller tweak * ui tweak * set shouldQuit field * remote connect notification * Lint fix * Randomize device id, new device on start * Lint fix * Lounge disconnect on start * Speed up lounge by not blocking on sent messages * add version to lounge data saved * dial server fix rendezvous * todo * no message * Display network name * playlist changes * Lint fix * tweak params * tweak * player state * comments * Refactor Video Queue (#295) * Refactor Video Queue * Video queue and playlists * Web app casting * queue playlist notification * VideoQueueView work * restore properties * changes * queue notification and previous/next state * Lint fix * very basic error handling * Update changelog and privacy policy --------- Co-authored-by: github-action linter <githubaction@githubaction.com>
This commit is contained in:
1 parent
ec9178d687
commit
7d1ba07286
85 files changed
+3666
-938
No files matched your search
@@ -0,0 +1,162 @@
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
|
||||
namespace VideoQueueUtils
|
||||
|
||||
function GetQueueDto(videoQueue as object) as object
|
||||
items = []
|
||||
nowPlaying = invalid
|
||||
|
||||
queueNodes = videoQueue.content.getChildren(-1, 0)
|
||||
for each node in queueNodes
|
||||
items.push({
|
||||
type: node.type
|
||||
videoId: node.videoId
|
||||
title: node.title
|
||||
author: node._author
|
||||
thumbnail: node.thumbnail
|
||||
})
|
||||
end for
|
||||
|
||||
nowPlayingNode = videoQueue.nowPlaying
|
||||
if nowPlayingNode <> invalid
|
||||
nowPlaying = {
|
||||
type: nowPlayingNode.type
|
||||
videoId: nowPlayingNode.videoId
|
||||
title: nowPlayingNode.title
|
||||
author: nowPlayingNode._author
|
||||
thumbnail: nowPlayingNode.thumbnail
|
||||
}
|
||||
end if
|
||||
|
||||
return {
|
||||
items: items
|
||||
nowPlaying: nowPlaying
|
||||
index: videoQueue.index
|
||||
}
|
||||
end function
|
||||
|
||||
function IsVideoPlayerFullScreen(videoQueue as object) as boolean
|
||||
return videoQueue.videoContainer.fullscreen
|
||||
end function
|
||||
|
||||
function ToggleVideoPictureInPicture(videoQueue as object) as boolean
|
||||
player = videoQueue.player
|
||||
if player = invalid
|
||||
return false
|
||||
end if
|
||||
videoContainer = videoQueue.videoContainer
|
||||
videoContainer.fullscreen = not videoContainer.fullscreen
|
||||
if videoContainer.fullscreen
|
||||
NodeSetFocus(player, true)
|
||||
else
|
||||
videoQueue.appController@.FocusTopScreen()
|
||||
end if
|
||||
return true
|
||||
end function
|
||||
|
||||
function IsVideoPlayerOpen(videoQueue as object) as boolean
|
||||
return videoQueue.player <> invalid
|
||||
end function
|
||||
|
||||
function Play(videoQueue as object) as boolean
|
||||
player = videoQueue.player
|
||||
if player = invalid
|
||||
return false
|
||||
end if
|
||||
videoQueue.play = true
|
||||
return true
|
||||
end function
|
||||
|
||||
function Pause(videoQueue as object) as boolean
|
||||
player = videoQueue.player
|
||||
if player = invalid
|
||||
return false
|
||||
end if
|
||||
videoQueue.pause = true
|
||||
return true
|
||||
end function
|
||||
|
||||
function Resume(videoQueue as object) as boolean
|
||||
player = videoQueue.player
|
||||
if player = invalid
|
||||
return false
|
||||
end if
|
||||
videoQueue.play = true
|
||||
return true
|
||||
end function
|
||||
|
||||
function TogglePause(videoQueue as object) as boolean
|
||||
player = videoQueue.player
|
||||
if player = invalid
|
||||
return false
|
||||
end if
|
||||
if player.state = "playing"
|
||||
player.control = "pause"
|
||||
return true
|
||||
else if player.state = "paused"
|
||||
player.control = "resume"
|
||||
return true
|
||||
end if
|
||||
return false
|
||||
end function
|
||||
|
||||
function PlayNext(videoQueue as object, invidiousNode as object, preferences as object) as boolean
|
||||
if videoQueue.hasNext
|
||||
videoQueue.next = true
|
||||
return true
|
||||
end if
|
||||
|
||||
if preferences["playback.autoplay"] <> true
|
||||
return false
|
||||
end if
|
||||
|
||||
player = videoQueue.player
|
||||
if player = invalid
|
||||
return false
|
||||
end if
|
||||
|
||||
content = player.content
|
||||
if content = invalid
|
||||
return false
|
||||
end if
|
||||
|
||||
metadata = content.metadata
|
||||
if metadata = invalid
|
||||
return false
|
||||
end if
|
||||
|
||||
recommendedVideos = metadata.recommendedVideos
|
||||
if recommendedVideos = invalid
|
||||
return false
|
||||
end if
|
||||
|
||||
if recommendedVideos = invalid or recommendedVideos.Count() = 0
|
||||
return false
|
||||
end if
|
||||
|
||||
queueContent = videoQueue.content
|
||||
for each recommendedVideo in recommendedVideos
|
||||
if recommendedVideo = invalid
|
||||
continue for
|
||||
end if
|
||||
videoId = recommendedVideo.videoId
|
||||
if videoId = invalid
|
||||
continue for
|
||||
end if
|
||||
|
||||
existingVideo = queueContent.findNode(videoId)
|
||||
if existingVideo <> invalid
|
||||
continue for
|
||||
end if
|
||||
|
||||
LogInfo(`Playing next recommended video (${videoId})`)
|
||||
instance = invidiousNode@.GetCurrentInstance()
|
||||
node = InvidiousContent.ToVideoContentNode(invalid, recommendedVideo, instance)
|
||||
videoQueue.playVideo = node
|
||||
return true
|
||||
end for
|
||||
|
||||
return false
|
||||
end function
|
||||
|
||||
end namespace
|
||||
Reference in new issue
Block a user