diff --git a/CHANGELOG.md b/CHANGELOG.md index ff19ede4..07c78042 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Also adds thumbnails/preview in trick play mode - Known issue: thumbnails might appear cropped/misaligned at the end of videos. This will be addressed in a later release. - Search filters in web app +- Channels and Playlists can be opened on TV from web app ### Fixed diff --git a/docs/playlet-web-api.yml b/docs/playlet-web-api.yml index faed1315..5dbd3d70 100644 --- a/docs/playlet-web-api.yml +++ b/docs/playlet-web-api.yml @@ -204,6 +204,29 @@ paths: responses: "204": description: No Content + /api/view/open: + get: + summary: Open a channel view or a playlist view + description: Open a channel view or a playlist view. If a video is playing in full screen, it is shrinked. + operationId: openView + parameters: + - name: channelId + in: query + description: The ID of the channel to open + required: false + schema: + type: string + - name: playlistId + in: query + description: The ID of the playlist to open + required: false + schema: + type: string + responses: + "204": + description: No Content + "400": + description: Bad Request /api/playlet-lib-urls: get: summary: Get Playlet lib URLs diff --git a/playlet-lib/src/components/ChannelView/ChannelUtils.bs b/playlet-lib/src/components/ChannelView/ChannelUtils.bs index d794da97..c40dac49 100644 --- a/playlet-lib/src/components/ChannelView/ChannelUtils.bs +++ b/playlet-lib/src/components/ChannelView/ChannelUtils.bs @@ -1,7 +1,10 @@ namespace ChannelUtils - function Open(contentNode as object) + function Open(contentNode as object, appController = invalid as object) channelView = CreateObject("roSGNode", "ChannelView") - m.appController@.PushScreen(channelView) + if appController = invalid + appController = m.appController + end if + appController@.PushScreen(channelView) channelView@.BindNode(invalid) channelView.content = contentNode end function diff --git a/playlet-lib/src/components/MainScene.xml b/playlet-lib/src/components/MainScene.xml index b4841509..3759dd74 100644 --- a/playlet-lib/src/components/MainScene.xml +++ b/playlet-lib/src/components/MainScene.xml @@ -60,6 +60,7 @@ + diff --git a/playlet-web/src/lib/Api/PlayletApi.ts b/playlet-web/src/lib/Api/PlayletApi.ts index cf13db21..0fd8c0c2 100644 --- a/playlet-web/src/lib/Api/PlayletApi.ts +++ b/playlet-web/src/lib/Api/PlayletApi.ts @@ -114,6 +114,20 @@ export class PlayletApi { return await response.json(); } + static async openPlaylist(playlistId) { + if (!playlistId) { + return; + } + await fetch(`${PlayletApi.host()}/api/view/open?playlistId=${playlistId}`); + } + + static async openChannel(authorId) { + if (!authorId) { + return; + } + await fetch(`${PlayletApi.host()}/api/view/open?authorId=${authorId}`); + } + static async getSearchHistory() { const response = await fetch(`${PlayletApi.host()}/api/search-history`); return await response.json(); diff --git a/playlet-web/src/lib/Screens/Home/ChannelCell.svelte b/playlet-web/src/lib/Screens/Home/ChannelCell.svelte index 35f41b4a..8efbdbc8 100644 --- a/playlet-web/src/lib/Screens/Home/ChannelCell.svelte +++ b/playlet-web/src/lib/Screens/Home/ChannelCell.svelte @@ -1,4 +1,5 @@