Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cc78fb0ec1 | ||
|
|
05f2481f87 | ||
|
|
bdaaf17785 | ||
|
|
a675811488 | ||
|
|
d80240130d | ||
|
|
459a009293 | ||
|
|
cf08c67de5 | ||
|
|
9cd664fdd7 | ||
|
|
ad753deac7 | ||
|
|
3acf733eec | ||
|
|
6c84630cec | ||
|
|
682e0bae7f | ||
|
|
02e206ad22 | ||
|
|
c40428f2d6 | ||
|
|
cb45732965 | ||
|
|
9ccf1efee9 | ||
|
|
5a7ebf95bc | ||
|
|
fef289a201 | ||
|
|
98de5f223e |
No files matched your search
@@ -31,6 +31,6 @@ jobs:
|
||||
github_token: ${{ secrets.GH_TOKEN }}
|
||||
|
||||
- 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:
|
||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
@@ -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/),
|
||||
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
|
||||
|
||||
### Added
|
||||
|
||||
@@ -25,14 +25,15 @@ Playlet is an unofficial Youtube client for Roku 📺
|
||||
- 🕵️ No Tracking
|
||||
- 🛡️ Privacy driven (uses Invidious backend)
|
||||
- ⚔️ SponsorBlock integration (skips undesirable sections in videos)
|
||||
- 📱 Cast from phone
|
||||
- 📱 Browse, search, and cast from phone using the web app
|
||||
- 🔮 Picture-in-picture mode
|
||||
- ⚡ Fast! [Check out how we compare with the official Youtube app](https://youtu.be/qmSvA-QQW20)
|
||||
|
||||
### Cast from phone
|
||||
1. Open settings in Playlet
|
||||
1. Open "Web app" tab in Playlet
|
||||
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
|
||||
- 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. Scan QR Code with Phone
|
||||
1. Change the Invidious instance
|
||||
1. You can also do this from the settings tab
|
||||
|
||||
## Screenshots
|
||||
|  |  |  |
|
||||
|----------------------|----------------------|----------------------|
|
||||
<a href="./screenshots/README.md">
|
||||
|
||||
|  |  |  |
|
||||
|----------------------------------|----------------------------------|----------------------------------|
|
||||
|
||||
</a>
|
||||
|
||||
More under [Screenshots](./screenshots/README.md)
|
||||
|
||||
## Installation
|
||||
### Roku Store (Published app)
|
||||
|
||||
@@ -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)
|
||||
@@ -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
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet",
|
||||
"version": "0.10.0",
|
||||
"version": "0.10.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet",
|
||||
"version": "0.10.0",
|
||||
"version": "0.10.1",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"bslib": "npm:@rokucommunity/bslib@^0.1.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet",
|
||||
"version": "0.10.0",
|
||||
"version": "0.10.1",
|
||||
"description": "Unofficial Youtube client for Roku",
|
||||
"dependencies": {
|
||||
"bslib": "npm:@rokucommunity/bslib@^0.1.1",
|
||||
@@ -24,9 +24,6 @@
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^5.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": "<19.0.0"
|
||||
},
|
||||
"ropm": {
|
||||
"rootDir": "playlet-lib/src",
|
||||
"noprefix": [
|
||||
|
||||
@@ -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
|
||||
@@ -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]
|
||||
@@ -21,14 +26,18 @@ function PlayVideo(videoId as string, args = invalid as object)
|
||||
height = videoContainer.videoPlayer.height
|
||||
translation = videoContainer.videoPlayer.translation
|
||||
end if
|
||||
previousSender = videoContainer.sender
|
||||
CloseVideo(false)
|
||||
if sender <> invalid
|
||||
videoContainer.sender = sender
|
||||
else
|
||||
videoContainer.sender = previousSender
|
||||
end if
|
||||
videoContainer.videoPlayer = videoContainer.createChild("VideoPlayer")
|
||||
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
|
||||
|
||||
@@ -33,7 +33,7 @@ function OnContentSet() as void
|
||||
else
|
||||
m.top.FindNode("liveRect").visible = false
|
||||
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
|
||||
else
|
||||
m.top.FindNode("durationRect").visible = false
|
||||
@@ -42,6 +42,18 @@ function OnContentSet() as void
|
||||
|
||||
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
|
||||
if m.thumbnail.loadStatus <> "failed"
|
||||
return
|
||||
|
||||
@@ -17,18 +17,18 @@
|
||||
<Rectangle
|
||||
id="durationRect"
|
||||
width="60"
|
||||
height="25"
|
||||
height="26"
|
||||
color="0x000000"
|
||||
opacity="0.8"
|
||||
translation="[290, 162]"
|
||||
>
|
||||
<Label
|
||||
width="60"
|
||||
height="25"
|
||||
height="26"
|
||||
id="durationLabel"
|
||||
horizAlign="center"
|
||||
vertAlign="center"
|
||||
font="font:SmallestSystemFont"
|
||||
translation="[8, 0]"
|
||||
/>
|
||||
</Rectangle>
|
||||
<Rectangle
|
||||
|
||||
@@ -23,8 +23,7 @@ namespace Http
|
||||
response.Default(204, "OK")
|
||||
return true
|
||||
else if payload.command = "play"
|
||||
videoId = payload.videoId
|
||||
server.task.top.command = `play:${videoId}`
|
||||
server.task.top.command = payload
|
||||
response.Default(204, "OK")
|
||||
return true
|
||||
else if payload.command = "set-playlet-lib-urls"
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
<component name="WebServerTask" extends="Task">
|
||||
<interface>
|
||||
<field id="login" type="boolean" alwaysNotify="true" />
|
||||
<field id="command" type="string" alwaysNotify="true" />
|
||||
<field id="command" type="assocarray" alwaysNotify="true" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -3,7 +3,7 @@ title=PlayletLib
|
||||
# Do not update version manually, it is auto updated from package.json
|
||||
major_version=0
|
||||
minor_version=10
|
||||
build_version=00000
|
||||
build_version=00001
|
||||
|
||||
sg_component_libs_provided=PlayletLib
|
||||
hidden=1
|
||||
|
||||
@@ -157,6 +157,8 @@ class InvidiousService
|
||||
|
||||
' 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
|
||||
' 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
|
||||
authToken = InvidiousSettings.GetAuthToken()
|
||||
if authToken = invalid
|
||||
|
||||
@@ -39,7 +39,12 @@ namespace InvidiousSettings
|
||||
if tokenPayload = invalid
|
||||
return invalid
|
||||
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
|
||||
|
||||
function GetBackupInstances() as object
|
||||
|
||||
@@ -1,17 +1,32 @@
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
namespace TimeUtils
|
||||
' Helper function convert seconds to mm:ss format
|
||||
' Helper function convert seconds to [hh:]mm:ss format
|
||||
' getTime(138) returns 2:18
|
||||
function GetFormattedTime(length as integer) as string
|
||||
minutes = (length \ 60).ToStr()
|
||||
hours = length \ 3600
|
||||
minutes = (length \ 60) mod 60
|
||||
seconds = length mod 60
|
||||
|
||||
if seconds < 10
|
||||
seconds = "0" + seconds.ToStr()
|
||||
else
|
||||
seconds = seconds.ToStr()
|
||||
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
|
||||
|
||||
function GetFormattedTimeLeft(unixTimestamp as integer) as string
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet-web",
|
||||
"version": "0.10.0",
|
||||
"version": "0.10.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-web",
|
||||
"version": "0.10.0",
|
||||
"version": "0.10.1",
|
||||
"devDependencies": {
|
||||
"@sveltejs/vite-plugin-svelte": "^2.4.2",
|
||||
"@tailwindcss/typography": "^0.5.9",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet-web",
|
||||
"version": "0.10.0",
|
||||
"version": "0.10.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -3,12 +3,16 @@
|
||||
import { PlayletApi } from "./PlayletApi";
|
||||
import { playletStateStore } from "./Stores";
|
||||
import { InvidiousApi } from "./InvidiousApi";
|
||||
import VideoStartAt from "./VideoStartAt.svelte";
|
||||
|
||||
let modal;
|
||||
let isDragging;
|
||||
let isLoading;
|
||||
let dragEndTimeout;
|
||||
|
||||
let videoStartAtChecked;
|
||||
let videoStartAtTimestamp;
|
||||
|
||||
let videoMetadata;
|
||||
|
||||
let tvName = "Roku TV";
|
||||
@@ -43,10 +47,10 @@
|
||||
let dataString = await new Promise((resolve) =>
|
||||
item.getAsString(resolve)
|
||||
);
|
||||
if (IsValidHttpUrl(dataString)) {
|
||||
const videoId = GetVideoId(dataString);
|
||||
if (videoId) {
|
||||
searchForVideoById(videoId);
|
||||
if (isValidHttpUrl(dataString)) {
|
||||
const videoInfo = parseYouTubeUrl(dataString);
|
||||
if (videoInfo.videoId) {
|
||||
searchForVideoById(videoInfo.videoId, videoInfo.timestamp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -54,10 +58,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function searchForVideoById(videoId) {
|
||||
async function searchForVideoById(videoId, timestamp) {
|
||||
try {
|
||||
isLoading = true;
|
||||
videoMetadata = await invidiousApi.getVideoMetadata(videoId);
|
||||
videoStartAtChecked = timestamp !== undefined;
|
||||
if (videoStartAtChecked) {
|
||||
videoStartAtTimestamp = timestamp;
|
||||
}
|
||||
modal.showModal();
|
||||
} finally {
|
||||
isLoading = false;
|
||||
@@ -74,7 +82,7 @@
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
function IsValidHttpUrl(string) {
|
||||
function isValidHttpUrl(string) {
|
||||
let url;
|
||||
try {
|
||||
url = new URL(string);
|
||||
@@ -84,7 +92,16 @@
|
||||
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
|
||||
// TODO: use regex, and support timestamped videos
|
||||
const YoutubeUrls = [
|
||||
@@ -100,33 +117,52 @@
|
||||
for (var i in YoutubeUrls) {
|
||||
let youtubeUrl = YoutubeUrls[i];
|
||||
if (url.startsWith(youtubeUrl)) {
|
||||
url = url.replace(youtubeUrl, "");
|
||||
if (url.includes("?")) {
|
||||
url = url.substring(0, url.indexOf("?"));
|
||||
let videoId = url.replace(youtubeUrl, "");
|
||||
if (videoId.includes("?")) {
|
||||
videoId = videoId.substring(0, videoId.indexOf("?"));
|
||||
}
|
||||
return url;
|
||||
const result: any = {
|
||||
videoId,
|
||||
};
|
||||
|
||||
const timestamp = getTimestamp();
|
||||
if (timestamp) {
|
||||
result.timestamp = timestamp;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
// regular url
|
||||
url = new URL(url);
|
||||
const urlSearchParams = new URLSearchParams(url.search);
|
||||
return urlSearchParams.get("v");
|
||||
const result: any = {
|
||||
videoId: urlSearchParams.get("v"),
|
||||
};
|
||||
|
||||
const timestamp = getTimestamp();
|
||||
if (timestamp) {
|
||||
result.timestamp = timestamp;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
async function playVideoOnTv() {
|
||||
await PlayletApi.playVideo(videoMetadata?.videoId);
|
||||
await PlayletApi.playVideo(videoMetadata?.videoId, videoStartAtTimestamp);
|
||||
}
|
||||
|
||||
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>
|
||||
|
||||
<div
|
||||
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}
|
||||
<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">
|
||||
<h3 class="text-lg m-5">{videoMetadata?.title}</h3>
|
||||
<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={openInvidiousInNewTab}
|
||||
>Open in Invidious</button
|
||||
|
||||
@@ -43,11 +43,15 @@ export class PlayletApi {
|
||||
return await PlayletApi.postJson(`${PlayletApi.host()}/api/command`, { command: "logout" });
|
||||
}
|
||||
|
||||
static async playVideo(videoId) {
|
||||
static async playVideo(videoId, timestamp) {
|
||||
if (!videoId) {
|
||||
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() {
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
// svelte-ignore unused-export-let
|
||||
export let defaultValue: any = undefined;
|
||||
// svelte-ignore unused-export-let
|
||||
export let rokuComponent: any = undefined;
|
||||
|
||||
const customComponents = {
|
||||
ClearSearchHistoryControl
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "./PlayletApi";
|
||||
import { playletStateStore } from "./Stores";
|
||||
import VideoStartAt from "./VideoStartAt.svelte";
|
||||
|
||||
export let title: string | undefined = undefined;
|
||||
export let videoId: string | undefined = undefined;
|
||||
@@ -39,6 +40,8 @@
|
||||
let modal;
|
||||
let tvName = "Roku TV";
|
||||
let invidiousInstance;
|
||||
let videoStartAtChecked;
|
||||
let videoStartAtTimestamp;
|
||||
|
||||
playletStateStore.subscribe((value) => {
|
||||
tvName = value?.device?.friendly_name ?? "Roku TV";
|
||||
@@ -49,14 +52,14 @@
|
||||
if (isUpcoming) {
|
||||
return `Premeres in ${getFormattedTimeLeft(premiereTimestamp)}`;
|
||||
}
|
||||
const pubText = publishedText || '';
|
||||
const pubText = publishedText || "";
|
||||
const viewCountText = formatViewCount(viewCount);
|
||||
|
||||
if (pubText === '' && viewCountText === '') {
|
||||
return '';
|
||||
if (pubText === "" && viewCountText === "") {
|
||||
return "";
|
||||
}
|
||||
|
||||
return `${pubText} • ${viewCountText}`;
|
||||
|
||||
return `${pubText} • ${viewCountText}`;
|
||||
}
|
||||
|
||||
function getFormattedTimeLeft(unixTimestamp) {
|
||||
@@ -148,10 +151,21 @@
|
||||
}
|
||||
|
||||
function getFormattedTime(length) {
|
||||
const minutes = Math.floor(length / 60).toString();
|
||||
const seconds = (length % 60);
|
||||
const hours = Math.floor(length / 3600);
|
||||
const minutes = Math.floor((length / 60) % 60);
|
||||
const seconds = length % 60;
|
||||
|
||||
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() {
|
||||
@@ -162,24 +176,41 @@
|
||||
}
|
||||
|
||||
async function playVideoOnTv() {
|
||||
await PlayletApi.playVideo(videoId);
|
||||
await PlayletApi.playVideo(videoId, videoStartAtTimestamp);
|
||||
}
|
||||
|
||||
function openInvidiousInNewTab() {
|
||||
window.open(`${invidiousInstance}/watch?v=${videoId}`)
|
||||
let url = `${invidiousInstance}/watch?v=${videoId}`;
|
||||
if (videoStartAtChecked && videoStartAtTimestamp) {
|
||||
url += `&t=${videoStartAtTimestamp}`;
|
||||
}
|
||||
window.open(url);
|
||||
}
|
||||
</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">
|
||||
<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()}
|
||||
<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>
|
||||
{: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}
|
||||
<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>
|
||||
{: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}
|
||||
</figure>
|
||||
<div class="card-body">
|
||||
@@ -194,12 +225,19 @@
|
||||
<form method="dialog" class="modal-box bg-base-100">
|
||||
<h3 class="text-lg m-5">{title}</h3>
|
||||
<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={openInvidiousInNewTab}>Open in Invidious</button>
|
||||
<button class="btn m-2" on:click={openInvidiousInNewTab}
|
||||
>Open in Invidious</button
|
||||
>
|
||||
<button class="btn m-2">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
<form method="dialog" class="modal-backdrop">
|
||||
<button>close</button>
|
||||
</form>
|
||||
</dialog>
|
||||
</dialog>
|
||||
@@ -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>
|
||||
@@ -3,7 +3,7 @@ title=Playlet
|
||||
# Do not update version manually, it is auto updated from package.json
|
||||
major_version=0
|
||||
minor_version=10
|
||||
build_version=00000
|
||||
build_version=00001
|
||||
|
||||
## Channel Assets
|
||||
### Main Menu Icons / Channel Poster Artwork
|
||||
|
||||
|
Before Width: | Height: | Size: 146 KiB |
|
Before Width: | Height: | Size: 82 KiB |
|
Before Width: | Height: | Size: 48 KiB |
@@ -0,0 +1,15 @@
|
||||
## Screenshots
|
||||
### Home
|
||||

|
||||
### Search
|
||||

|
||||
### Settings
|
||||

|
||||
### Link to web app
|
||||

|
||||
### App info
|
||||

|
||||
|
||||
### Web app
|
||||
|  |  |  |
|
||||
|----------------------------------|----------------------------------|----------------------------------|
|
||||
|
After Width: | Height: | Size: 83 KiB |
|
After Width: | Height: | Size: 80 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 358 KiB |
|
After Width: | Height: | Size: 362 KiB |
|
After Width: | Height: | Size: 99 KiB |