Compare commits

...
19 Commits
Author SHA1 Message Date
Brahim Hadriche cc78fb0ec1 Release Release v0.10.1 (#93) 2023-06-28 15:00:15 -04:00
Brahim Hadricheandgithub-action linter 05f2481f87 Fix a focus bug (#92)
* Fix a focus bug

* Lint fix

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2023-06-28 14:55:31 -04:00
Brahim Hadricheandgithub-action linter bdaaf17785 Fix duration formatting (#91)
* Fix duration formatting

* Lint fix

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2023-06-28 13:42:23 -04:00
Brahim Hadriche a675811488 Fix for bad auth token (#90) 2023-06-28 09:27:04 -04:00
Brahim Hadriche d80240130d Update README.md 2023-06-27 20:04:29 -04:00
Brahim Hadriche 459a009293 Update README.md 2023-06-27 20:03:54 -04:00
Brahim Hadriche cf08c67de5 Remove node version limitation 2023-06-25 17:53:17 -04:00
Brahim Hadriche 9cd664fdd7 Missed this bit 2023-06-25 16:33:05 -04:00
Brahim Hadriche ad753deac7 Small fix 2023-06-25 16:27:34 -04:00
Brahim Hadriche 3acf733eec 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
2023-06-25 16:17:12 -04:00
Brahim Hadriche 6c84630cec Better changelogs for automated releases 2023-06-25 11:37:46 -04:00
Brahim Hadriche 682e0bae7f Update RELEASING.md 2023-06-25 11:21:21 -04:00
Brahim Hadriche 02e206ad22 Update RELEASING.md 2023-06-25 11:20:15 -04:00
Brahim Hadriche c40428f2d6 Update README.md 2023-06-25 10:59:03 -04:00
Brahim Hadriche cb45732965 Update RELEASING.md 2023-06-25 06:01:39 -04:00
Brahim Hadriche 9ccf1efee9 Add release steps 2023-06-25 05:58:43 -04:00
Brahim Hadriche 5a7ebf95bc Update README.md 2023-06-25 05:37:58 -04:00
Brahim Hadriche fef289a201 Screenshots (#87)
* Screenshots

* Update README.md

* fix links

* Web app

* Update README.md
2023-06-25 05:34:10 -04:00
Brahim Hadriche 98de5f223e Screenshots 2023-06-25 05:17:50 -04:00
39 changed files with 368 additions and 68 deletions

No files matched your search

+1 -1
View File
@@ -31,6 +31,6 @@ jobs:
github_token: ${{ secrets.GH_TOKEN }} github_token: ${{ secrets.GH_TOKEN }}
- name: Create unstable release - name: Create unstable release
run: gh release create unstable ./release/playlet.zip ./playlet/src/lib/playlet-lib.zip --notes "This is an automated release." --prerelease --title unstable run: gh release create unstable ./release/playlet.zip ./playlet/src/lib/playlet-lib.zip --notes-file docs/unstable-changelog.md --prerelease --title unstable
env: env:
GH_TOKEN: ${{ secrets.GH_TOKEN }} GH_TOKEN: ${{ secrets.GH_TOKEN }}
+12
View File
@@ -5,6 +5,18 @@ 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/), 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). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.10.1] - 2023-06-28
### Added
- Support playing a video from a specific time (cast from phone, drag and drop, open in Invidious)
### Fixed
- A crash where the saved auth token is not in a valid format
- Video duration formatting for long videos
- A bug where app would lose focus when playing the next video (0.10.0 regression)
## [0.10.0] - 2023-06-25 ## [0.10.0] - 2023-06-25
### Added ### Added
+13 -5
View File
@@ -25,14 +25,15 @@ Playlet is an unofficial Youtube client for Roku 📺
- 🕵️ No Tracking - 🕵️ No Tracking
- 🛡️ Privacy driven (uses Invidious backend) - 🛡️ Privacy driven (uses Invidious backend)
- ⚔️ SponsorBlock integration (skips undesirable sections in videos) - ⚔️ SponsorBlock integration (skips undesirable sections in videos)
- 📱 Cast from phone - 📱 Browse, search, and cast from phone using the web app
- 🔮 Picture-in-picture mode - 🔮 Picture-in-picture mode
- ⚡ Fast! [Check out how we compare with the official Youtube app](https://youtu.be/qmSvA-QQW20) - ⚡ Fast! [Check out how we compare with the official Youtube app](https://youtu.be/qmSvA-QQW20)
### Cast from phone ### Cast from phone
1. Open settings in Playlet 1. Open "Web app" tab in Playlet
1. Scan QR Code with Phone 1. Scan QR Code with Phone
1. Enter video ID or video url, and press Play button 1. Browse or search videos
1. Click the video and choose the "Play on TV" option
### Picture-in-picture ### Picture-in-picture
- When viewing a video in full screen, press ⬇️ (down) button on your remote to shrink the video - When viewing a video in full screen, press ⬇️ (down) button on your remote to shrink the video
@@ -43,10 +44,17 @@ Playlet is an unofficial Youtube client for Roku 📺
1. Open settings in Playlet 1. Open settings in Playlet
1. Scan QR Code with Phone 1. Scan QR Code with Phone
1. Change the Invidious instance 1. Change the Invidious instance
1. You can also do this from the settings tab
## Screenshots ## Screenshots
| ![](screenshot1.jpg) | ![](screenshot2.jpg) | ![](screenshot3.jpg) | <a href="./screenshots/README.md">
|----------------------|----------------------|----------------------|
| ![](screenshots/screenshot1.jpg) | ![](screenshots/screenshot2.jpg) | ![](screenshots/screenshot3.jpg) |
|----------------------------------|----------------------------------|----------------------------------|
</a>
More under [Screenshots](./screenshots/README.md)
## Installation ## Installation
### Roku Store (Published app) ### Roku Store (Published app)
+40
View File
@@ -0,0 +1,40 @@
<!-- markdownlint-disable MD036 -->
# Releasing
These are mostly the steps when releasing a new version:
## Playlet lib
- Create local branch `release/$VERSION` e.g. `release/0.10.0`
- Set version in package.json
- Update CHANGELOG.md section from `[Unreleased]` to `[$VERSION] - DATE`
- `npm run build:release`
- This should fail because there are uncommitted changes. This is expected.
- Commit changes
- Create pull request
- Title: `Release v$VERSION`
- Comment: `Release $VERSION \nIt should contain everything planned from #6`
- Wait for CI and merge
- Wait for CI on main branch to create the `unstable` release
- Edit `unstable` release
- Tag: `v$VERSION`
- Title: `v$VERSION`
- Body: the content from CHANGELOG.md for this version
- Uncheck `Set as a pre-release`
- Check `Set as the latest release`
- Click `update release`
- Update [Roadmap](https://github.com/iBicha/playlet/issues/6)
- If current versions says `Planned for $VERSION`, change it to `Released in $VERSION`
- Add a `Planned for $VERSION` for the next version
**The newest Playlet lib is now LIVE**
## Playlet
For releasing to the store (when needed), this is done following a Playlet lib release:
- Switch to main branch and pull changes - **match commit corresponding to the release.**
- `npm run build:release`
- This should create the signed package under `release/playlet.pkg`
- Upload to dashboard, and schedule a release (takes a couple of days)
+11
View File
@@ -0,0 +1,11 @@
<!-- markdownlint-disable MD041 -->
This is an automated release. It is generated when new code is pushed to the main branch.
To test this release:
- Open Playlet web app in dev mode (`http://ROKU_IP_ADDRESS:8888/index.html?dev=1`)
- 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
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet", "name": "playlet",
"version": "0.10.0", "version": "0.10.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet", "name": "playlet",
"version": "0.10.0", "version": "0.10.1",
"hasInstallScript": true, "hasInstallScript": true,
"dependencies": { "dependencies": {
"bslib": "npm:@rokucommunity/bslib@^0.1.1", "bslib": "npm:@rokucommunity/bslib@^0.1.1",
+1 -4
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet", "name": "playlet",
"version": "0.10.0", "version": "0.10.1",
"description": "Unofficial Youtube client for Roku", "description": "Unofficial Youtube client for Roku",
"dependencies": { "dependencies": {
"bslib": "npm:@rokucommunity/bslib@^0.1.1", "bslib": "npm:@rokucommunity/bslib@^0.1.1",
@@ -24,9 +24,6 @@
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "^5.1.3" "typescript": "^5.1.3"
}, },
"engines": {
"node": "<19.0.0"
},
"ropm": { "ropm": {
"rootDir": "playlet-lib/src", "rootDir": "playlet-lib/src",
"noprefix": [ "noprefix": [
+7 -4
View File
@@ -113,8 +113,11 @@ function OnWebServerLogin()
m.homeGridScreen.refresh = true m.homeGridScreen.refresh = true
end function end function
function OnWebServerCommand() function OnWebServerCommand() as void
if m.serverTask.command.StartsWith("play:") 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 sender = m.videoContainer.sender ?? m.currentFocued
if m.videoContainer.fullscreen if m.videoContainer.fullscreen
dialog = m.top.getScene().dialog dialog = m.top.getScene().dialog
@@ -122,7 +125,7 @@ function OnWebServerCommand()
dialog.close = true dialog.close = true
end if end if
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 if
end function end function
@@ -146,5 +149,5 @@ function PlayVideoFromArgs(args as object) as void
end if end if
sender = m.videoContainer.sender ?? m.currentFocued sender = m.videoContainer.sender ?? m.currentFocued
PlayVideo(args.contentId, { sender: sender }) PlayVideo(args.contentId, { sender: sender, timestamp: args.timestamp })
end function end function
@@ -7,11 +7,16 @@ import "pkg:/components/VideoPlayer/MarkVideoWatchedTask.bs"
function PlayVideo(videoId as string, args = invalid as object) function PlayVideo(videoId as string, args = invalid as object)
sender = args?.sender sender = args?.sender
metadata = args?.metadata metadata = args?.metadata
timestamp = args?.timestamp
if metadata <> invalid and GetInterface(metadata, "ifSGNodeField") <> invalid if metadata <> invalid and GetInterface(metadata, "ifSGNodeField") <> invalid
metadata = args.metadata.getFields() metadata = args.metadata.getFields()
end if end if
if timestamp = invalid
timestamp = 0
end if
width = 1280 width = 1280
height = 720 height = 720
translation = [0.0, 0.0] translation = [0.0, 0.0]
@@ -21,14 +26,18 @@ function PlayVideo(videoId as string, args = invalid as object)
height = videoContainer.videoPlayer.height height = videoContainer.videoPlayer.height
translation = videoContainer.videoPlayer.translation translation = videoContainer.videoPlayer.translation
end if end if
previousSender = videoContainer.sender
CloseVideo(false) CloseVideo(false)
if sender <> invalid if sender <> invalid
videoContainer.sender = sender videoContainer.sender = sender
else
videoContainer.sender = previousSender
end if end if
videoContainer.videoPlayer = videoContainer.createChild("VideoPlayer") videoContainer.videoPlayer = videoContainer.createChild("VideoPlayer")
videoContainer.insertChild(videoContainer.videoPlayer, 0) videoContainer.insertChild(videoContainer.videoPlayer, 0)
videoContainer.videoPlayer.id = "VideoPlayer" videoContainer.videoPlayer.id = "VideoPlayer"
videoContainer.videoPlayer.metadata = metadata videoContainer.videoPlayer.metadata = metadata
videoContainer.videoPlayer.timestamp = timestamp
videoContainer.videoPlayer.videoId = videoId videoContainer.videoPlayer.videoId = videoId
videoContainer.videoPlayer.width = width videoContainer.videoPlayer.width = width
videoContainer.videoPlayer.height = height 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). ' 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. ' 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 m.videoPlayingSuccess = true
if m.top.timestamp <> 0
m.top.seek = m.top.timestamp
end if
end if end if
if state = "error" if state = "error"
@@ -7,6 +7,7 @@
<field id="chapter" type="string" alias="chapterLabel.text" /> <field id="chapter" type="string" alias="chapterLabel.text" />
<field id="videoId" type="string" /> <field id="videoId" type="string" />
<field id="metadata" type="assocarray" /> <field id="metadata" type="assocarray" />
<field id="timestamp" type="integer" />
</interface> </interface>
<children> <children>
<Label <Label
@@ -33,7 +33,7 @@ function OnContentSet() as void
else else
m.top.FindNode("liveRect").visible = false m.top.FindNode("liveRect").visible = false
if content.lengthSeconds <> invalid and content.lengthSeconds <> 0 if content.lengthSeconds <> invalid and content.lengthSeconds <> 0
m.top.FindNode("durationLabel").text = TimeUtils.GetFormattedTime(content.lengthSeconds) SetDurationText(TimeUtils.GetFormattedTime(content.lengthSeconds))
m.top.FindNode("durationRect").visible = true m.top.FindNode("durationRect").visible = true
else else
m.top.FindNode("durationRect").visible = false m.top.FindNode("durationRect").visible = false
@@ -42,6 +42,18 @@ function OnContentSet() as void
end function end function
function SetDurationText(text as string)
label = m.top.FindNode("durationLabel")
rect = m.top.FindNode("durationRect")
rectParent = rect.getParent()
label.text = text
size = label.localBoundingRect()
rect.width = size.width + 16
rect.translation = [rectParent.width - rect.width, 162]
end function
function OnThumbnailLoadFailed() as void function OnThumbnailLoadFailed() as void
if m.thumbnail.loadStatus <> "failed" if m.thumbnail.loadStatus <> "failed"
return return
@@ -17,18 +17,18 @@
<Rectangle <Rectangle
id="durationRect" id="durationRect"
width="60" width="60"
height="25" height="26"
color="0x000000" color="0x000000"
opacity="0.8" opacity="0.8"
translation="[290, 162]" translation="[290, 162]"
> >
<Label <Label
width="60" height="26"
height="25"
id="durationLabel" id="durationLabel"
horizAlign="center" horizAlign="center"
vertAlign="center" vertAlign="center"
font="font:SmallestSystemFont" font="font:SmallestSystemFont"
translation="[8, 0]"
/> />
</Rectangle> </Rectangle>
<Rectangle <Rectangle
@@ -23,8 +23,7 @@ namespace Http
response.Default(204, "OK") response.Default(204, "OK")
return true return true
else if payload.command = "play" else if payload.command = "play"
videoId = payload.videoId server.task.top.command = payload
server.task.top.command = `play:${videoId}`
response.Default(204, "OK") response.Default(204, "OK")
return true return true
else if payload.command = "set-playlet-lib-urls" else if payload.command = "set-playlet-lib-urls"
@@ -3,6 +3,6 @@
<component name="WebServerTask" extends="Task"> <component name="WebServerTask" extends="Task">
<interface> <interface>
<field id="login" type="boolean" alwaysNotify="true" /> <field id="login" type="boolean" alwaysNotify="true" />
<field id="command" type="string" alwaysNotify="true" /> <field id="command" type="assocarray" alwaysNotify="true" />
</interface> </interface>
</component> </component>
+1 -1
View File
@@ -3,7 +3,7 @@ title=PlayletLib
# Do not update version manually, it is auto updated from package.json # Do not update version manually, it is auto updated from package.json
major_version=0 major_version=0
minor_version=10 minor_version=10
build_version=00000 build_version=00001
sg_component_libs_provided=PlayletLib sg_component_libs_provided=PlayletLib
hidden=1 hidden=1
@@ -157,6 +157,8 @@ class InvidiousService
' Public Invidious instances fail a lot randomly, even with valid tokens ' Public Invidious instances fail a lot randomly, even with valid tokens
' For that reason, it's better to make sure the token actually expired by date ' For that reason, it's better to make sure the token actually expired by date
' TODO: this happens because instance owners do not set hmac_key https://github.com/iv-org/invidious/issues/3854
' Once hmac_key is enforced, this check can be removed.
function IsTokenMaybeExpired() as dynamic function IsTokenMaybeExpired() as dynamic
authToken = InvidiousSettings.GetAuthToken() authToken = InvidiousSettings.GetAuthToken()
if authToken = invalid if authToken = invalid
@@ -39,7 +39,12 @@ namespace InvidiousSettings
if tokenPayload = invalid if tokenPayload = invalid
return invalid return invalid
end if end if
return ParseJson(tokenPayload) authData = ParseJson(tokenPayload)
if authData = invalid or authData.instance = invalid or authData.token = invalid
RegistryUtils.Delete(RegistryUtils.INVIDIOUS_TOKEN)
return invalid
end if
return authData
end function end function
function GetBackupInstances() as object function GetBackupInstances() as object
+18 -3
View File
@@ -1,17 +1,32 @@
import "pkg:/source/utils/Types.bs" import "pkg:/source/utils/Types.bs"
namespace TimeUtils namespace TimeUtils
' Helper function convert seconds to mm:ss format ' Helper function convert seconds to [hh:]mm:ss format
' getTime(138) returns 2:18 ' getTime(138) returns 2:18
function GetFormattedTime(length as integer) as string function GetFormattedTime(length as integer) as string
minutes = (length \ 60).ToStr() hours = length \ 3600
minutes = (length \ 60) mod 60
seconds = length mod 60 seconds = length mod 60
if seconds < 10 if seconds < 10
seconds = "0" + seconds.ToStr() seconds = "0" + seconds.ToStr()
else else
seconds = seconds.ToStr() seconds = seconds.ToStr()
end if end if
return minutes + ":" + seconds
if minutes < 10 and hours > 0
minutes = "0" + minutes.ToStr()
else
minutes = minutes.ToStr()
end if
formattedTime = minutes + ":" + seconds
if hours > 0
formattedTime = hours.ToStr() + ":" + formattedTime
end if
return formattedTime
end function end function
function GetFormattedTimeLeft(unixTimestamp as integer) as string function GetFormattedTimeLeft(unixTimestamp as integer) as string
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet-web", "name": "playlet-web",
"version": "0.10.0", "version": "0.10.1",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet-web", "name": "playlet-web",
"version": "0.10.0", "version": "0.10.1",
"devDependencies": { "devDependencies": {
"@sveltejs/vite-plugin-svelte": "^2.4.2", "@sveltejs/vite-plugin-svelte": "^2.4.2",
"@tailwindcss/typography": "^0.5.9", "@tailwindcss/typography": "^0.5.9",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-web", "name": "playlet-web",
"version": "0.10.0", "version": "0.10.1",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
+58 -17
View File
@@ -3,12 +3,16 @@
import { PlayletApi } from "./PlayletApi"; import { PlayletApi } from "./PlayletApi";
import { playletStateStore } from "./Stores"; import { playletStateStore } from "./Stores";
import { InvidiousApi } from "./InvidiousApi"; import { InvidiousApi } from "./InvidiousApi";
import VideoStartAt from "./VideoStartAt.svelte";
let modal; let modal;
let isDragging; let isDragging;
let isLoading; let isLoading;
let dragEndTimeout; let dragEndTimeout;
let videoStartAtChecked;
let videoStartAtTimestamp;
let videoMetadata; let videoMetadata;
let tvName = "Roku TV"; let tvName = "Roku TV";
@@ -43,10 +47,10 @@
let dataString = await new Promise((resolve) => let dataString = await new Promise((resolve) =>
item.getAsString(resolve) item.getAsString(resolve)
); );
if (IsValidHttpUrl(dataString)) { if (isValidHttpUrl(dataString)) {
const videoId = GetVideoId(dataString); const videoInfo = parseYouTubeUrl(dataString);
if (videoId) { if (videoInfo.videoId) {
searchForVideoById(videoId); searchForVideoById(videoInfo.videoId, videoInfo.timestamp);
return; return;
} }
} }
@@ -54,10 +58,14 @@
} }
} }
async function searchForVideoById(videoId) { async function searchForVideoById(videoId, timestamp) {
try { try {
isLoading = true; isLoading = true;
videoMetadata = await invidiousApi.getVideoMetadata(videoId); videoMetadata = await invidiousApi.getVideoMetadata(videoId);
videoStartAtChecked = timestamp !== undefined;
if (videoStartAtChecked) {
videoStartAtTimestamp = timestamp;
}
modal.showModal(); modal.showModal();
} finally { } finally {
isLoading = false; isLoading = false;
@@ -74,7 +82,7 @@
event.preventDefault(); event.preventDefault();
} }
function IsValidHttpUrl(string) { function isValidHttpUrl(string) {
let url; let url;
try { try {
url = new URL(string); url = new URL(string);
@@ -84,7 +92,16 @@
return url.protocol === "http:" || url.protocol === "https:"; return url.protocol === "http:" || url.protocol === "https:";
} }
function GetVideoId(url) { function parseYouTubeUrl(url) {
const urlSearchParams = new URLSearchParams(new URL(url).search);
function getTimestamp() {
const timestamp = urlSearchParams.get("t");
if (timestamp) {
return timestamp.endsWith("s") ? timestamp.slice(0, -1) : timestamp;
}
}
// Share/Short url // Share/Short url
// TODO: use regex, and support timestamped videos // TODO: use regex, and support timestamped videos
const YoutubeUrls = [ const YoutubeUrls = [
@@ -100,33 +117,52 @@
for (var i in YoutubeUrls) { for (var i in YoutubeUrls) {
let youtubeUrl = YoutubeUrls[i]; let youtubeUrl = YoutubeUrls[i];
if (url.startsWith(youtubeUrl)) { if (url.startsWith(youtubeUrl)) {
url = url.replace(youtubeUrl, ""); let videoId = url.replace(youtubeUrl, "");
if (url.includes("?")) { if (videoId.includes("?")) {
url = url.substring(0, url.indexOf("?")); videoId = videoId.substring(0, videoId.indexOf("?"));
} }
return url; const result: any = {
videoId,
};
const timestamp = getTimestamp();
if (timestamp) {
result.timestamp = timestamp;
}
return result;
} }
} }
// regular url // regular url
url = new URL(url); const result: any = {
const urlSearchParams = new URLSearchParams(url.search); videoId: urlSearchParams.get("v"),
return urlSearchParams.get("v"); };
const timestamp = getTimestamp();
if (timestamp) {
result.timestamp = timestamp;
}
return result;
} }
async function playVideoOnTv() { async function playVideoOnTv() {
await PlayletApi.playVideo(videoMetadata?.videoId); await PlayletApi.playVideo(videoMetadata?.videoId, videoStartAtTimestamp);
} }
function openInvidiousInNewTab() { function openInvidiousInNewTab() {
window.open(`${invidiousInstance}/watch?v=${videoMetadata?.videoId}`); let url = `${invidiousInstance}/watch?v=${videoMetadata?.videoId}`;
if (videoStartAtChecked && videoStartAtTimestamp) {
url += `&t=${videoStartAtTimestamp}`;
}
window.open(url);
} }
</script> </script>
<div <div
class="{isDragging || isLoading class="{isDragging || isLoading
? '' ? ''
: 'hidden'} absolute w-full h-full bg-base-100/80 z-50 flex justify-center items-center" : 'hidden'} fixed w-full h-full bg-base-100/80 z-50 flex justify-center items-center"
> >
{#if isDragging} {#if isDragging}
<div class="text-2xl font-bold">Drop a Youtube link here</div> <div class="text-2xl font-bold">Drop a Youtube link here</div>
@@ -139,6 +175,11 @@
<form method="dialog" class="modal-box bg-base-100"> <form method="dialog" class="modal-box bg-base-100">
<h3 class="text-lg m-5">{videoMetadata?.title}</h3> <h3 class="text-lg m-5">{videoMetadata?.title}</h3>
<div class="flex flex-col"> <div class="flex flex-col">
<VideoStartAt
bind:checked={videoStartAtChecked}
bind:timestamp={videoStartAtTimestamp}
lengthSeconds={videoMetadata?.lengthSeconds}
/>
<button class="btn m-2" on:click={playVideoOnTv}>Play on {tvName}</button> <button class="btn m-2" on:click={playVideoOnTv}>Play on {tvName}</button>
<button class="btn m-2" on:click={openInvidiousInNewTab} <button class="btn m-2" on:click={openInvidiousInNewTab}
>Open in Invidious</button >Open in Invidious</button
+6 -2
View File
@@ -43,11 +43,15 @@ export class PlayletApi {
return await PlayletApi.postJson(`${PlayletApi.host()}/api/command`, { command: "logout" }); return await PlayletApi.postJson(`${PlayletApi.host()}/api/command`, { command: "logout" });
} }
static async playVideo(videoId) { static async playVideo(videoId, timestamp) {
if (!videoId) { if (!videoId) {
return; return;
} }
return await PlayletApi.postJson(`${PlayletApi.host()}/api/command`, { command: "play", videoId: videoId }); const payload = { command: "play", videoId: videoId };
if (timestamp !== undefined) {
payload["timestamp"] = timestamp;
}
return await PlayletApi.postJson(`${PlayletApi.host()}/api/command`, payload);
} }
static async getSearchHistory() { static async getSearchHistory() {
+2
View File
@@ -18,6 +18,8 @@
// svelte-ignore unused-export-let // svelte-ignore unused-export-let
export let defaultValue: any = undefined; export let defaultValue: any = undefined;
// svelte-ignore unused-export-let
export let rokuComponent: any = undefined;
const customComponents = { const customComponents = {
ClearSearchHistoryControl ClearSearchHistoryControl
+54 -16
View File
@@ -1,6 +1,7 @@
<script lang="ts"> <script lang="ts">
import { PlayletApi } from "./PlayletApi"; import { PlayletApi } from "./PlayletApi";
import { playletStateStore } from "./Stores"; import { playletStateStore } from "./Stores";
import VideoStartAt from "./VideoStartAt.svelte";
export let title: string | undefined = undefined; export let title: string | undefined = undefined;
export let videoId: string | undefined = undefined; export let videoId: string | undefined = undefined;
@@ -39,6 +40,8 @@
let modal; let modal;
let tvName = "Roku TV"; let tvName = "Roku TV";
let invidiousInstance; let invidiousInstance;
let videoStartAtChecked;
let videoStartAtTimestamp;
playletStateStore.subscribe((value) => { playletStateStore.subscribe((value) => {
tvName = value?.device?.friendly_name ?? "Roku TV"; tvName = value?.device?.friendly_name ?? "Roku TV";
@@ -49,11 +52,11 @@
if (isUpcoming) { if (isUpcoming) {
return `Premeres in ${getFormattedTimeLeft(premiereTimestamp)}`; return `Premeres in ${getFormattedTimeLeft(premiereTimestamp)}`;
} }
const pubText = publishedText || ''; const pubText = publishedText || "";
const viewCountText = formatViewCount(viewCount); const viewCountText = formatViewCount(viewCount);
if (pubText === '' && viewCountText === '') { if (pubText === "" && viewCountText === "") {
return ''; return "";
} }
return `${pubText} • ${viewCountText}`; return `${pubText} • ${viewCountText}`;
@@ -148,10 +151,21 @@
} }
function getFormattedTime(length) { function getFormattedTime(length) {
const minutes = Math.floor(length / 60).toString(); const hours = Math.floor(length / 3600);
const seconds = (length % 60); const minutes = Math.floor((length / 60) % 60);
const seconds = length % 60;
const secondsString = seconds < 10 ? `0${seconds}` : seconds.toString(); const secondsString = seconds < 10 ? `0${seconds}` : seconds.toString();
return minutes + ":" + secondsString; const minutesString =
minutes < 10 && hours > 0 ? `0${minutes}` : minutes.toString();
let formattedTime = minutesString + ":" + secondsString;
if (hours > 0) {
formattedTime = hours.toString() + ":" + formattedTime;
}
return formattedTime;
} }
function isVideoLive() { function isVideoLive() {
@@ -162,24 +176,41 @@
} }
async function playVideoOnTv() { async function playVideoOnTv() {
await PlayletApi.playVideo(videoId); await PlayletApi.playVideo(videoId, videoStartAtTimestamp);
} }
function openInvidiousInNewTab() { function openInvidiousInNewTab() {
window.open(`${invidiousInstance}/watch?v=${videoId}`) let url = `${invidiousInstance}/watch?v=${videoId}`;
if (videoStartAtChecked && videoStartAtTimestamp) {
url += `&t=${videoStartAtTimestamp}`;
}
window.open(url);
} }
</script> </script>
<button class="w-80 p-2" on:click="{modal.showModal()}"> <button class="w-80 p-2" on:click={modal.showModal()}>
<div class="card card-compact bg-base-100 shadow-xl border border-neutral"> <div class="card card-compact bg-base-100 shadow-xl border border-neutral">
<figure class="relative"> <figure class="relative">
<img class="w-full rounded-box" loading="lazy" width="320" height="180" src={getThumbnailUrl()} alt={title} /> <img
class="w-full rounded-box"
loading="lazy"
width="320"
height="180"
src={getThumbnailUrl()}
alt={title}
/>
{#if isVideoLive()} {#if isVideoLive()}
<div class="absolute bottom-2 right-0 bg-red-500 text-white text-sm rounded-sm font-bold pt-1 pb-1 pr-2 pl-2">LIVE</div> <div
{:else} class="absolute bottom-2 right-0 bg-red-500 text-white text-sm rounded-sm font-bold pt-1 pb-1 pr-2 pl-2"
{#if lengthSeconds} >
<div class="absolute bottom-2 right-0 bg-black/70 text-white text-sm rounded-sm pt-1 pb-1 pr-2 pl-2">{getFormattedTime(lengthSeconds)}</div> LIVE
{/if} </div>
{:else if lengthSeconds}
<div
class="absolute bottom-2 right-0 bg-black/70 text-white text-sm rounded-sm pt-1 pb-1 pr-2 pl-2"
>
{getFormattedTime(lengthSeconds)}
</div>
{/if} {/if}
</figure> </figure>
<div class="card-body"> <div class="card-body">
@@ -194,8 +225,15 @@
<form method="dialog" class="modal-box bg-base-100"> <form method="dialog" class="modal-box bg-base-100">
<h3 class="text-lg m-5">{title}</h3> <h3 class="text-lg m-5">{title}</h3>
<div class="flex flex-col"> <div class="flex flex-col">
<VideoStartAt
bind:checked={videoStartAtChecked}
bind:timestamp={videoStartAtTimestamp}
{lengthSeconds}
/>
<button class="btn m-2" on:click={playVideoOnTv}>Play on {tvName}</button> <button class="btn m-2" on:click={playVideoOnTv}>Play on {tvName}</button>
<button class="btn m-2" on:click={openInvidiousInNewTab}>Open in Invidious</button> <button class="btn m-2" on:click={openInvidiousInNewTab}
>Open in Invidious</button
>
<button class="btn m-2">Cancel</button> <button class="btn m-2">Cancel</button>
</div> </div>
</form> </form>
+83
View File
@@ -0,0 +1,83 @@
<script lang="ts">
export let checked = false;
export let lengthSeconds = undefined;
export let timestamp = 0;
let textInputElemet;
let timestampText = "";
let timestampRange = 0;
$: {
if (document.activeElement !== textInputElemet) {
timestampText = getTimeStampText(timestamp);
}
}
$: timestampRange = timestamp !== undefined ? timestamp : 0;
function getTimeStamp(timestampText) {
if (timestampText === "") {
return 0;
}
const match = /^(\d{1,3}):(\d{1,2})$/.exec(timestampText);
if (match) {
const minutes = parseInt(match[1]);
const seconds = parseInt(match[2]);
if (seconds < 60) {
return minutes * 60 + seconds;
}
}
}
function getTimeStampText(timestamp) {
if (timestamp === undefined) {
return "";
}
const minutes = Math.floor(timestamp / 60);
const remainingSeconds = timestamp % 60;
const formattedMinutes = String(minutes);
const formattedSeconds = String(remainingSeconds).padStart(2, "0");
return `${formattedMinutes}:${formattedSeconds}`;
}
</script>
<div class="form-control">
<div class="flex flex-row items-center">
<label class="label justify-start cursor-pointer">
<input type="checkbox" bind:checked class="checkbox" />
<span class="label-text m-2">Start at</span>
</label>
<input
bind:this={textInputElemet}
disabled={!checked}
class="input w-24"
placeholder="0:00"
bind:value={timestampText}
on:input={(e) => {
timestamp = getTimeStamp(e.currentTarget.value);
}}
/>
{#if checked}
{#if timestamp !== undefined}
<span class="label-text m-2">({timestamp}s)</span>
{:else}
<span class="label-text m-2 text-error">(Invalid time)</span>
{/if}
{/if}
</div>
{#if lengthSeconds && checked}
<input
type="range"
min="0"
max={lengthSeconds}
bind:value={timestampRange}
on:input={(e) => {
// @ts-ignore
timestamp = e.currentTarget.value;
}}
class="range range-xs range-primary"
/>
{/if}
</div>
+1 -1
View File
@@ -3,7 +3,7 @@ title=Playlet
# Do not update version manually, it is auto updated from package.json # Do not update version manually, it is auto updated from package.json
major_version=0 major_version=0
minor_version=10 minor_version=10
build_version=00000 build_version=00001
## Channel Assets ## Channel Assets
### Main Menu Icons / Channel Poster Artwork ### Main Menu Icons / Channel Poster Artwork
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

+15
View File
@@ -0,0 +1,15 @@
## Screenshots
### Home
![](./screenshot1.jpg)
### Search
![](./screenshot2.jpg)
### Settings
![](./screenshot3.jpg)
### Link to web app
![](./screenshot4.jpg)
### App info
![](./screenshot5.jpg)
### Web app
| ![](./screenshot6.png) | ![](./screenshot7.png) | ![](./screenshot8.png) |
|----------------------------------|----------------------------------|----------------------------------|
Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB