Compare commits

...
28 Commits
Author SHA1 Message Date
Brahim Hadriche 98d81a4773 Release v0.47.3 (#895) 2026-06-22 20:12:56 -04:00
Brahim Hadriche 7310befaaf Live streaming improvements 2026-06-22 20:07:41 -04:00
Brahim Hadriche 4d047909fc fix playback speed message in lounge 2026-06-22 14:55:05 -04:00
Brahim Hadriche 105b9ab12c Attempt to fix low quality videos, by downgrading tv client version 2026-06-22 09:47:12 -04:00
Brahim Hadriche 4588e9dbbb Release v0.47.2 (#894) 2026-06-21 20:06:33 -04:00
Brahim Hadriche 95dff3bc07 Attempt to fix low quality videos, by downgrading tv client version 2026-06-21 19:51:54 -04:00
Brahim Hadriche 9980b591b3 Live streams no longer fail with a 502 error on transient segment failures 2026-06-21 16:00:32 -04:00
Brahim Hadriche e8f1a98cfe Move attachments to extra field in telemetry 2026-06-21 13:21:10 -04:00
Brahim Hadriche 513c13420a Format fix 2026-06-20 18:48:30 -04:00
Brahim Hadriche c32431fefc Report previous-run crashes to diagnostics 2026-06-20 18:42:10 -04:00
Brahim Hadriche d03909f8d6 Playlist second page fix 2026-06-20 12:03:10 -04:00
Brahim Hadriche bbabb3184d page reload fix 2026-06-18 17:19:12 -04:00
Brahim Hadriche 354acad5a6 Release v0.47.1 (#889) 2026-06-18 12:55:02 -04:00
Brahim Hadriche a2e56dd700 update dependencies (#885) 2026-06-18 12:48:59 -04:00
Brahim Hadriche 0f33f72cc1 [skip ci] various fixes 2026-06-18 12:10:21 -04:00
Brahim Hadriche 0c7bd4b3e0 [skip ci] captions minimize fix 2026-06-18 10:23:49 -04:00
Brahim Hadriche f7c508f8db Release v0.47.0 (#888) 2026-06-17 21:20:35 -04:00
Brahim Hadriche 62dcc14042 [skip-ci] SponsorBlock "Hook/Greetings" category 2026-06-17 21:09:35 -04:00
Brahim Hadriche 7a976bbe3d Fixed captions on some videos (from TV broadcasts) displaying vertically instead of horizontally 2026-06-17 12:24:28 -04:00
Brahim Hadriche 2830311aa8 [skip ci] some tooling work 2026-06-17 10:47:50 -04:00
Brahim Hadriche cdee8a713b [skip ci] update client versions 2026-06-13 19:20:17 -04:00
Brahim Hadriche 986be7e224 [skip ci] fix stats script 2026-06-13 10:20:55 -04:00
Brahim Hadriche dd8c1b4e28 Fixed missing video durations in channel pages, when using Playlet backend 2026-06-12 19:29:39 -04:00
Brahim Hadriche dcd6def22b [skip ci] lint fixes 2026-06-12 17:41:19 -04:00
Brahim Hadriche ef83b598eb 4K support for AV1 2026-06-12 17:16:40 -04:00
Brahim Hadriche 35b38c7cd8 [skip ci] plugin guard 2026-06-12 15:12:36 -04:00
Brahim Hadriche c0dce836cf [skip ci] bsc explicit projects 2026-06-12 12:44:34 -04:00
Brahim Hadriche 29dd94352e [skip ci] video player button focus nudge 2026-06-12 12:44:20 -04:00
81 changed files with 1226 additions and 399 deletions

No files matched your search

+6
View File
@@ -8,4 +8,10 @@
"editor.formatOnSave": true, "editor.formatOnSave": true,
"xml.format.maxLineWidth": 0, "xml.format.maxLineWidth": 0,
"svelte.enable-ts-plugin": true, "svelte.enable-ts-plugin": true,
"brightscript.projects": [
"playlet-app/bsconfig.json",
"playlet-app/bsconfig.tests.json",
"playlet-lib/bsconfig.json",
"playlet-lib/bsconfig.tests.json"
]
} }
+41
View File
@@ -5,6 +5,47 @@ 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.1.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.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.47.3] - 2026-06-23
### Fixed
- Attempt to fix low quality videos, by downgrading tv client version
- Live streaming improvements
## [0.47.2] - 2026-06-21
### Fixed
- Attempt to fix the "The page needs to be reloaded" error by refreshing the signature timestamp automatically
- Playlists with more than one page of videos no longer stop loading after the first ~100 videos
- Report previous-run crashes to diagnostics
- Live streams no longer fail with a 502 error on transient segment failures
- Attempt to fix low quality videos, by downgrading tv client version
## [0.47.1] - 2026-06-18
### Fixed
- Subtitles no longer stop displaying after shrinking the video to picture-in-picture and restoring it
- Fixed a video player crash that could occur near the end of a video
- Fixed a startup crash caused by corrupted saved-profiles data in the registry
- Fixed a crash that could occur when the video player failed to start playback
## [0.47.0] - 2026-06-18
### Added
- Support for 4K video
- Playlet already supported 4K videos. This adds a support check, and quality selectors in the settings, for the devices that support it.
- Not all 4k supporting devices - only with AV1 support (usually newer devices)
- Not all 4k videos are playable, only AV1 encoded videos
- SponsorBlock "Hook/Greetings" category
### Fixed
- Missing video durations in channel pages, when using Playlet backend
- Captions on some videos (from TV broadcasts) displaying vertically instead of horizontally
## [0.46.0] - 2026-06-12 ## [0.46.0] - 2026-06-12
### Added ### Added
+3 -1
View File
@@ -98,7 +98,9 @@
"../tools/bs-plugins/logger-plugin.ts", "../tools/bs-plugins/logger-plugin.ts",
"../tools/bs-plugins/web-server-plugin.ts", "../tools/bs-plugins/web-server-plugin.ts",
"../tools/bs-plugins/locale-validation-plugin.ts", "../tools/bs-plugins/locale-validation-plugin.ts",
"../tools/bs-plugins/proto-gen-plugin.ts" "../tools/bs-plugins/proto-gen-plugin.ts",
// Must be last: fails the command if any plugin above failed to load
"../tools/bs-plugins/critical-exit-guard-plugin.ts"
], ],
"retainStagingDir": true, "retainStagingDir": true,
"require": [ "require": [
+3 -1
View File
@@ -28,7 +28,9 @@
"../tools/bs-plugins/logger-plugin.ts", "../tools/bs-plugins/logger-plugin.ts",
"../tools/bs-plugins/web-server-plugin.ts", "../tools/bs-plugins/web-server-plugin.ts",
"../tools/bs-plugins/locale-validation-plugin.ts", "../tools/bs-plugins/locale-validation-plugin.ts",
"../tools/bs-plugins/proto-gen-plugin.ts" "../tools/bs-plugins/proto-gen-plugin.ts",
// Must be last: fails the command if any plugin above failed to load
"../tools/bs-plugins/critical-exit-guard-plugin.ts"
], ],
"rooibos": { "rooibos": {
"logLevel": 2, "logLevel": 2,
+1
View File
@@ -2,6 +2,7 @@
"globals": [], "globals": [],
"ignores": [ "ignores": [
"**/roku_modules/**/*", "**/roku_modules/**/*",
"**/components/rooibos/**/*",
"**/bslib.brs" "**/bslib.brs"
], ],
"rules": { "rules": {
+44 -44
View File
@@ -1,22 +1,22 @@
{ {
"name": "playlet", "name": "playlet",
"version": "0.46.0", "version": "0.47.3",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet", "name": "playlet",
"version": "0.46.0", "version": "0.47.3",
"hasInstallScript": true, "hasInstallScript": true,
"devDependencies": { "devDependencies": {
"@rokucommunity/bslint": "^0.8.43", "@rokucommunity/bslint": "^0.8.44",
"@types/crypto-js": "^4.2.2", "@types/crypto-js": "^4.2.2",
"@types/fs-extra": "^11.0.4", "@types/fs-extra": "^11.0.4",
"@types/node": "^25.9.2", "@types/node": "^25.9.3",
"@types/xml2js": "^0.4.14", "@types/xml2js": "^0.4.14",
"argparse": "^2.0.1", "argparse": "^2.0.1",
"brighterscript": "0.72.4", "brighterscript": "0.72.5",
"brighterscript-formatter": "^1.7.26", "brighterscript-formatter": "^1.7.27",
"convert-svg-to-png": "^0.7.1", "convert-svg-to-png": "^0.7.1",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
"dotenv": "^17.4.2", "dotenv": "^17.4.2",
@@ -30,9 +30,9 @@
"puppeteer": "^25.1.0", "puppeteer": "^25.1.0",
"roku-deploy": "^3.17.6", "roku-deploy": "^3.17.6",
"roku-test-automation": "^2.2.2", "roku-test-automation": "^2.2.2",
"rooibos-roku": "5.16.3", "rooibos-roku": "5.16.4",
"rounded-rect-9patch": "^1.1.2", "rounded-rect-9patch": "^1.1.2",
"semver": "^7.8.2", "semver": "^7.8.4",
"shelljs": "^0.10.0", "shelljs": "^0.10.0",
"telnet-client": "^2.2.13", "telnet-client": "^2.2.13",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
@@ -72,9 +72,9 @@
} }
}, },
"node_modules/@babel/runtime": { "node_modules/@babel/runtime": {
"version": "7.29.2", "version": "7.29.7",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.2.tgz", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.7.tgz",
"integrity": "sha512-JiDShH45zKHWyGe4ZNVRrCjBz8Nh9TMmZG1kh4QTK8hCBTWBi8Da+i7s1fJw7/lYpM4ccepSNfqzZ/QvABBi5g==", "integrity": "sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
@@ -290,9 +290,9 @@
"dev": true "dev": true
}, },
"node_modules/@rokucommunity/bslint": { "node_modules/@rokucommunity/bslint": {
"version": "0.8.43", "version": "0.8.44",
"resolved": "https://registry.npmjs.org/@rokucommunity/bslint/-/bslint-0.8.43.tgz", "resolved": "https://registry.npmjs.org/@rokucommunity/bslint/-/bslint-0.8.44.tgz",
"integrity": "sha512-B0XB+IPHr26Lci6Wn5iHSdOLTxnSNQKpWvGAM8NovMOPIVXoy/1UPicPu2Lvy6qkbtZQS0ZWZdGicCMubR+pjg==", "integrity": "sha512-IGKlXT/4GIXirI9ssWGGxCMComRIYisrf8OjdvpyxrMke4hC8bMnPJUk8e1RbikFFLwQjiufidnbvApqTeq7mQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -323,9 +323,9 @@
} }
}, },
"node_modules/@rokucommunity/logger": { "node_modules/@rokucommunity/logger": {
"version": "0.3.12", "version": "0.3.13",
"resolved": "https://registry.npmjs.org/@rokucommunity/logger/-/logger-0.3.12.tgz", "resolved": "https://registry.npmjs.org/@rokucommunity/logger/-/logger-0.3.13.tgz",
"integrity": "sha512-opavck0zTav3scRXth2VTvUU7a7VjEF/OYBF8J75PCPTTMf9TJpUL5rzNgvDGW3WnYPInmI1j6JS+EsCpbDDQA==", "integrity": "sha512-lbpHoYn6HmWY7aXPyFebHh/9J6aBYCafTz6CFWz/ssrlqQgs9QLPqypna/Jdp7lABY+OvToYx5QfK2Y7Jll+DA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -626,9 +626,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "25.9.2", "version": "25.9.3",
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.9.2.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-25.9.3.tgz",
"integrity": "sha512-G05zqtJhcDLb8uslf5EjCxXg9G1KQxiV8OS0R26IC//Eoyitzqe8z37I7cqvnZlrlSfgocQRfSn/AHBZJJFyGw==", "integrity": "sha512-603BddQMv3pUcr4U2dhujk83N2tTDVr/34wII2B6bJy6g+8WD6yUb11jszNs0gdi4PesVWl7ABt8nYMVpnLUcg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -1198,14 +1198,14 @@
} }
}, },
"node_modules/brighterscript": { "node_modules/brighterscript": {
"version": "0.72.4", "version": "0.72.5",
"resolved": "https://registry.npmjs.org/brighterscript/-/brighterscript-0.72.4.tgz", "resolved": "https://registry.npmjs.org/brighterscript/-/brighterscript-0.72.5.tgz",
"integrity": "sha512-WFim0n9pUgFZorZ81eIy2jF09XsFNxlLtllXYkH7d36Pq/3AH6M31YfIHkKSDltnXwrnCCjGXa+m0Jw3NnQIeQ==", "integrity": "sha512-Wod6+FuAqzus4A9JcXyl5+h1n2D7A4sSgfRP3wqSZdnv2xogQYBoY4E1IaXPTSjWomsmdhblv8PmySkm4M0A+g==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@rokucommunity/bslib": "^0.1.1", "@rokucommunity/bslib": "^0.1.1",
"@rokucommunity/logger": "^0.3.12", "@rokucommunity/logger": "^0.3.13",
"@xml-tools/parser": "^1.0.7", "@xml-tools/parser": "^1.0.7",
"array-flat-polyfill": "^1.0.1", "array-flat-polyfill": "^1.0.1",
"chalk": "^2.4.2", "chalk": "^2.4.2",
@@ -1230,7 +1230,7 @@
"parse-ms": "^2.1.0", "parse-ms": "^2.1.0",
"readline": "^1.3.0", "readline": "^1.3.0",
"require-relative": "^0.8.7", "require-relative": "^0.8.7",
"roku-deploy": "^3.17.5", "roku-deploy": "^3.17.6",
"safe-json-stringify": "^1.2.0", "safe-json-stringify": "^1.2.0",
"semver": "^7.7.3", "semver": "^7.7.3",
"serialize-error": "^7.0.1", "serialize-error": "^7.0.1",
@@ -1250,13 +1250,13 @@
} }
}, },
"node_modules/brighterscript-formatter": { "node_modules/brighterscript-formatter": {
"version": "1.7.26", "version": "1.7.27",
"resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.7.26.tgz", "resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.7.27.tgz",
"integrity": "sha512-hXu1tqzOvjgVy84NvS0rAhyIAOKp5Yvp32If73BuwWXjIt6NC0NeQSgmm5libgPcSOcDhpBuPXmcH+huA8Xmow==", "integrity": "sha512-OLM98hMXIsHMR6vWvmwq9x8K8qyMZj6h3UscKns6TLSHKD28rpRwC0FciEMhPmxCeHei8w2bK++BbLUDAYzsmQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"brighterscript": "^0.72.2", "brighterscript": "^0.72.5",
"glob-all": "^3.3.0", "glob-all": "^3.3.0",
"jsonc-parser": "^3.0.0", "jsonc-parser": "^3.0.0",
"source-map": "0.7.4", "source-map": "0.7.4",
@@ -5662,17 +5662,17 @@
} }
}, },
"node_modules/roku-debug": { "node_modules/roku-debug": {
"version": "0.23.8", "version": "0.23.13",
"resolved": "https://registry.npmjs.org/roku-debug/-/roku-debug-0.23.8.tgz", "resolved": "https://registry.npmjs.org/roku-debug/-/roku-debug-0.23.13.tgz",
"integrity": "sha512-XiTT6a8yCbU+aTMuuVMdhbj+OTQLJ/dxfyxavLQTrFfiDTU75KwQRJ9DA6juf7VS1PARdPFljhEhzGfBDFhJ+g==", "integrity": "sha512-J9cxuEvuVRtGhke+x54icpFt1VE2FIJMvPJ3VSR8CJJmAVXIe78mJ0QuV+GguV/D4q6apLeCoTjdaY4F/3MO9g==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@rokucommunity/logger": "^0.3.12", "@rokucommunity/logger": "^0.3.13",
"@types/request": "^2.48.8", "@types/request": "^2.48.8",
"@vscode/debugadapter": "^1.68.0", "@vscode/debugadapter": "^1.68.0",
"@vscode/debugprotocol": "^1.68.0", "@vscode/debugprotocol": "^1.68.0",
"brighterscript": "^0.72.2", "brighterscript": "^0.72.5",
"dateformat": "^4.6.3", "dateformat": "^4.6.3",
"debounce": "^1.2.1", "debounce": "^1.2.1",
"eol": "^0.9.1", "eol": "^0.9.1",
@@ -5686,7 +5686,7 @@
"postman-request": "^2.88.1-postman.48", "postman-request": "^2.88.1-postman.48",
"replace-in-file": "^6.3.2", "replace-in-file": "^6.3.2",
"replace-last": "^1.2.6", "replace-last": "^1.2.6",
"roku-deploy": "^3.17.4", "roku-deploy": "^3.17.6",
"semver": "^7.5.4", "semver": "^7.5.4",
"serialize-error": "^8.1.0", "serialize-error": "^8.1.0",
"smart-buffer": "^4.2.0", "smart-buffer": "^4.2.0",
@@ -6000,18 +6000,18 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/rooibos-roku": { "node_modules/rooibos-roku": {
"version": "5.16.3", "version": "5.16.4",
"resolved": "https://registry.npmjs.org/rooibos-roku/-/rooibos-roku-5.16.3.tgz", "resolved": "https://registry.npmjs.org/rooibos-roku/-/rooibos-roku-5.16.4.tgz",
"integrity": "sha512-dI7hV+OdpC9VtH82+EQY8rOfzQrD7N73ntMjsKmGjqV9O5DRpapB0E0VAJqaUaqeJ3bR7TmAY7LKKEO/QVLpqQ==", "integrity": "sha512-XpK+RXxrKpjBdFJa42VfIDuPKfi5G1RqLPl/slvOfLhD7zUjS0xov3bTu00fa0Mzb+jb3FUJ/wkt1vxljNZaDQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"brighterscript": "^0.72.2", "brighterscript": "^0.72.5",
"fast-glob": "^3.2.12", "fast-glob": "^3.2.12",
"fs-extra": "^10.1.0", "fs-extra": "^10.1.0",
"minimatch": "^3.0.4", "minimatch": "^3.0.4",
"roku-debug": "^0.23.8", "roku-debug": "^0.23.11",
"roku-deploy": "^3.17.4", "roku-deploy": "^3.17.6",
"rooibos_promises": "npm:@rokucommunity/promises@^0.5.0", "rooibos_promises": "npm:@rokucommunity/promises@^0.5.0",
"source-map": "^0.7.3", "source-map": "^0.7.3",
"undent": "^1.0.1", "undent": "^1.0.1",
@@ -6190,9 +6190,9 @@
} }
}, },
"node_modules/semver": { "node_modules/semver": {
"version": "7.8.2", "version": "7.8.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.2.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.4.tgz",
"integrity": "sha512-c8jsqUZm3omBOI66G90z1Dyw5z622G8oLG+omfsHBJf3CWQTlOcwOjvOG6wtiNfW6anKm/eA39LMwMtMez2TiQ==", "integrity": "sha512-rUCObTnP32Q08R2uuIrt7r9PlEonuTmtuXYcW6s5kjdlj3xbnwe+21yXptAUYcMAABLkYYTtnmzb3w3EDZfueA==",
"dev": true, "dev": true,
"license": "ISC", "license": "ISC",
"bin": { "bin": {
+11 -7
View File
@@ -1,16 +1,16 @@
{ {
"name": "playlet", "name": "playlet",
"version": "0.46.0", "version": "0.47.3",
"description": "Unofficial YouTube client for Roku", "description": "Unofficial YouTube client for Roku",
"devDependencies": { "devDependencies": {
"@rokucommunity/bslint": "^0.8.43", "@rokucommunity/bslint": "^0.8.44",
"@types/crypto-js": "^4.2.2", "@types/crypto-js": "^4.2.2",
"@types/fs-extra": "^11.0.4", "@types/fs-extra": "^11.0.4",
"@types/node": "^25.9.2", "@types/node": "^25.9.3",
"@types/xml2js": "^0.4.14", "@types/xml2js": "^0.4.14",
"argparse": "^2.0.1", "argparse": "^2.0.1",
"brighterscript": "0.72.4", "brighterscript": "0.72.5",
"brighterscript-formatter": "^1.7.26", "brighterscript-formatter": "^1.7.27",
"convert-svg-to-png": "^0.7.1", "convert-svg-to-png": "^0.7.1",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
"dotenv": "^17.4.2", "dotenv": "^17.4.2",
@@ -24,9 +24,9 @@
"puppeteer": "^25.1.0", "puppeteer": "^25.1.0",
"roku-deploy": "^3.17.6", "roku-deploy": "^3.17.6",
"roku-test-automation": "^2.2.2", "roku-test-automation": "^2.2.2",
"rooibos-roku": "5.16.3", "rooibos-roku": "5.16.4",
"rounded-rect-9patch": "^1.1.2", "rounded-rect-9patch": "^1.1.2",
"semver": "^7.8.2", "semver": "^7.8.4",
"shelljs": "^0.10.0", "shelljs": "^0.10.0",
"telnet-client": "^2.2.13", "telnet-client": "^2.2.13",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
@@ -42,6 +42,7 @@
"dev:web": "cd playlet-web && npm run dev", "dev:web": "cd playlet-web && npm run dev",
"prebuild": "node tools/rm.js dist", "prebuild": "node tools/rm.js dist",
"build:dev": "npm run prebuild && npm run build:web && npm run build:lib:dev && npm run build:app:dev", "build:dev": "npm run prebuild && npm run build:web && npm run build:lib:dev && npm run build:app:dev",
"build:dev:v2": "PLAYLET_DEVTOOLS=1 npm run build:dev",
"build:prod": "npm run prebuild && npm run build:web && npm run build:lib:prod && npm run build:app:prod", "build:prod": "npm run prebuild && npm run build:web && npm run build:lib:prod && npm run build:app:prod",
"build:release": "npm run prebuild && npm run format:fix && npm run lint:fix && npm run version-sync && npm run manifest-git-hash && npm run build:prod", "build:release": "npm run prebuild && npm run format:fix && npm run lint:fix && npm run version-sync && npm run manifest-git-hash && npm run build:prod",
"build:app:dev": "cd playlet-app && npm run build:dev", "build:app:dev": "cd playlet-app && npm run build:dev",
@@ -55,6 +56,9 @@
"format": "cd playlet-lib && npm run format && cd ../playlet-app && npm run format", "format": "cd playlet-lib && npm run format && cd ../playlet-app && npm run format",
"format:fix": "cd playlet-lib && npm run format:fix && cd ../playlet-app && npm run format:fix", "format:fix": "cd playlet-lib && npm run format:fix && cd ../playlet-app && npm run format:fix",
"test": "npm run test:lib && npm run test:app", "test": "npm run test:lib && npm run test:app",
"test:v2": "npm run test:v2:lib && npm run test:v2:app",
"test:v2:lib": "cd playlet-lib && npm run test:v2",
"test:v2:app": "cd playlet-app && npm run test:v2",
"test:build": "npm run test:build:lib && npm run test:build:app", "test:build": "npm run test:build:lib && npm run test:build:app",
"test:app": "cd playlet-app && npm run test", "test:app": "cd playlet-app && npm run test",
"test:build:app": "cd playlet-app && npm run test:build", "test:build:app": "cd playlet-app && npm run test:build",
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet-app", "name": "playlet-app",
"version": "0.46.0", "version": "0.47.3",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet-app", "name": "playlet-app",
"version": "0.46.0" "version": "0.47.3"
} }
} }
} }
+5 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-app", "name": "playlet-app",
"version": "0.46.0", "version": "0.47.3",
"description": "Unofficial YouTube client for Roku", "description": "Unofficial YouTube client for Roku",
"scripts": { "scripts": {
"prebuild": "node ../tools/rm.js ../build/playlet-app", "prebuild": "node ../tools/rm.js ../build/playlet-app",
@@ -18,6 +18,9 @@
"format:fix": "npm run format:base -- --write", "format:fix": "npm run format:base -- --write",
"test": "npm run test:build && npm run test:run", "test": "npm run test:build && npm run test:run",
"test:build": "bsc --project bsconfig.tests.json --create-package --sourceMap=true --debug --test-mode --lintConfig ../config/bslint.jsonc", "test:build": "bsc --project bsconfig.tests.json --create-package --sourceMap=true --debug --test-mode --lintConfig ../config/bslint.jsonc",
"test:run": "node ../tools/run-test-app.js --package ../build/playlet-app-tests.zip" "test:run": "node ../tools/run-test-app.js --package ../build/playlet-app-tests.zip",
"test:v2": "npm run test:build && npm run test:run:v2",
"pretest:run:v2": "../../../dev-tools/bin/ensure-service.sh",
"test:run:v2": "../../../dev-tools/bin/test-app.sh --package ../build/playlet-app-tests.zip --output ../build/playlet-app-tests.txt"
} }
} }
@@ -6,6 +6,7 @@
<field id="playletLibLoadedUrl" type="assocarray" /> <field id="playletLibLoadedUrl" type="assocarray" />
<field id="systemLogEvent" type="assocarray" alwaysNotify="true" /> <field id="systemLogEvent" type="assocarray" alwaysNotify="true" />
<field id="enableSystemLogType" type="string" /> <field id="enableSystemLogType" type="string" />
<field id="lastExitInfo" type="assocarray" />
</interface> </interface>
<script type="text/brightscript" uri="pkg:/source/Dialog.bs" /> <script type="text/brightscript" uri="pkg:/source/Dialog.bs" />
<script type="text/brightscript" uri="pkg:/source/Manifest.bs" /> <script type="text/brightscript" uri="pkg:/source/Manifest.bs" />
+2 -2
View File
@@ -2,8 +2,8 @@ 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=46 minor_version=47
build_version=00000 build_version=00003
ui_resolutions=hd ui_resolutions=hd
uri_resolution_autosub=$$RES$$,480p,720p,1080p uri_resolution_autosub=$$RES$$,480p,720p,1080p
+14
View File
@@ -0,0 +1,14 @@
namespace AppManager
function CaptureLastExitInfo(scene as object) as void
manager = CreateObject("roAppManager")
' roAppManager.GetLastExitInfo() is only available on Roku OS 13 and above
if FindMemberFunction(manager, "GetLastExitInfo") = invalid
return
end if
lastExitInfo = manager.GetLastExitInfo()
Logger.LogLastExitInfo(lastExitInfo)
scene.lastExitInfo = lastExitInfo
end function
end namespace
+29
View File
@@ -0,0 +1,29 @@
namespace Tests
@suite
class AppManagerTests extends Rooibos.BaseTestSuite
@describe("AppManager")
@it("captures the device's last exit info onto the scene")
function _()
manager = CreateObject("roAppManager")
scene = {}
AppManager.CaptureLastExitInfo(scene)
if FindMemberFunction(manager, "GetLastExitInfo") = invalid
' Roku OS < 13: nothing to capture
m.assertInvalid(scene.lastExitInfo)
else
info = scene.lastExitInfo
m.assertAAHasKeys(info, ["exit_code", "timestamp", "app_state", "console_log"])
m.assertTrue(info.exit_code.StartsWith("EXIT_"), "exit_code should be an EXIT_* string")
m.assertTrue(Len(info.timestamp) > 0, "timestamp should be a non-empty string")
m.assertTrue(Len(info.app_state) > 0, "app_state should be a non-empty string")
m.assertTrue(GetInterface(info.console_log, "ifString") <> invalid, "console_log should be a string")
end if
end function
end class
end namespace
+1 -9
View File
@@ -16,15 +16,7 @@ namespace Logger
buffer.AppendFile(LOGS_FILE_PATH) buffer.AppendFile(LOGS_FILE_PATH)
end function end function
function LogLastExitInfo() as void function LogLastExitInfo(lastExitInfo as object) as void
' roAppManager.GetLastExitInfo() is only available on Roku OS 13 and above
appManager = CreateObject("roAppManager")
hasMethod = FindMemberFunction(appManager, "GetLastExitInfo") <> invalid
if not hasMethod
return
end if
lastExitInfo = appManager.GetLastExitInfo()
if lastExitInfo = invalid if lastExitInfo = invalid
return return
end if end if
+2 -2
View File
@@ -24,11 +24,11 @@ function Main(args as object) as void
Registry.ClearPlayletLibUrlsIfNeeded(args) Registry.ClearPlayletLibUrlsIfNeeded(args)
Registry.ClearRegistryIfNeeded(args) Registry.ClearRegistryIfNeeded(args)
Logger.LogLastExitInfo()
scene = screen.CreateScene("BootstrapScene") scene = screen.CreateScene("BootstrapScene")
screen.show() screen.show()
AppManager.CaptureLastExitInfo(scene)
SetScenePalette(scene) SetScenePalette(scene)
scene.ObserveField("exitChannel", port) scene.ObserveField("exitChannel", port)
scene.launchArgs = args scene.launchArgs = args
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet-lib", "name": "playlet-lib",
"version": "0.46.0", "version": "0.47.3",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet-lib", "name": "playlet-lib",
"version": "0.46.0" "version": "0.47.3"
} }
} }
} }
+5 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-lib", "name": "playlet-lib",
"version": "0.46.0", "version": "0.47.3",
"description": "Unofficial YouTube client for Roku", "description": "Unofficial YouTube client for Roku",
"scripts": { "scripts": {
"prebuild": "node ../tools/rm.js ../build/playlet-lib", "prebuild": "node ../tools/rm.js ../build/playlet-lib",
@@ -20,6 +20,9 @@
"format:fix": "npm run format:base -- --write", "format:fix": "npm run format:base -- --write",
"test": "npm run test:build && npm run test:run", "test": "npm run test:build && npm run test:run",
"test:build": "bsc --project bsconfig.tests.json --create-package --sourceMap=true --debug --test-mode --lintConfig ../config/bslint.jsonc", "test:build": "bsc --project bsconfig.tests.json --create-package --sourceMap=true --debug --test-mode --lintConfig ../config/bslint.jsonc",
"test:run": "node ../tools/run-test-app.js --package ../build/playlet-lib-tests.zip" "test:run": "node ../tools/run-test-app.js --package ../build/playlet-lib-tests.zip",
"test:v2": "npm run test:build && npm run test:run:v2",
"pretest:run:v2": "../../../dev-tools/bin/ensure-service.sh",
"test:run:v2": "../../../dev-tools/bin/test-app.sh --package ../build/playlet-lib-tests.zip --output ../build/playlet-lib-tests.txt"
} }
} }
@@ -1,5 +1,6 @@
import "pkg:/components/Navigation/Navigation.bs" import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs" import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
import "pkg:/source/utils/CodecCapabilities.bs"
import "pkg:/source/utils/Logging.bs" import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/MathUtils.bs" import "pkg:/source/utils/MathUtils.bs"
import "pkg:/source/utils/RemoteKeys.bs" import "pkg:/source/utils/RemoteKeys.bs"
@@ -19,12 +20,48 @@ function Init()
m.saveButton.observeField("buttonSelected", FuncName(OnSaveButtonSelected)) m.saveButton.observeField("buttonSelected", FuncName(OnSaveButtonSelected))
m.closeButton.observeField("buttonSelected", FuncName(Close)) m.closeButton.observeField("buttonSelected", FuncName(Close))
m.lastCheckedState = [false, false, false, false, false, false, false] AddHighQualityOptions()
m.lastCheckedState = NewCheckedState(false, false)
m.checkList.observeField("checkedState", FuncName(OnCheckedStateChange)) m.checkList.observeField("checkedState", FuncName(OnCheckedStateChange))
SetButtonPositions() SetButtonPositions()
end function end function
' 1440p/2160p exist on YouTube only as AV1 (mp4) and VP9 (webm) streams, and the
' player only plays fragmented MP4 in DASH, so the options only work with an AV1 decoder.
function AddHighQualityOptions() as void
if not CodecCapabilities.CanDecodeAv1()
return
end if
content = m.checkList.content
for each quality in ["1440p", "2160p"]
node = CreateObject("roSGNode", "ContentNode")
node.id = quality
node.title = quality
content.insertChild(node, 1)
end for
end function
function NewCheckedState(autoChecked as boolean, othersChecked as boolean) as object
checkedState = [autoChecked]
count = m.checkList.content.getChildCount()
for i = 1 to count - 1
checkedState.push(othersChecked)
end for
return checkedState
end function
function AllQualitiesValue() as string
values = []
checkboxes = m.checkList.content.getChildren(-1, 0)
for i = 1 to checkboxes.Count() - 1
values.push(checkboxes[i].id)
end for
return values.Join(",")
end function
function SetButtonPositions() function SetButtonPositions()
saveButtonWidth = m.saveButton.width saveButtonWidth = m.saveButton.width
closeButtonWidth = m.closeButton.width closeButtonWidth = m.closeButton.width
@@ -99,16 +136,16 @@ function OnCheckedStateChange() as void
if autoChanged if autoChanged
if hasAuto if hasAuto
checkedState = [true, false, false, false, false, false, false] checkedState = NewCheckedState(true, false)
m.lastCheckedState = checkedState m.lastCheckedState = checkedState
m.checkList.checkedState = checkedState m.checkList.checkedState = checkedState
m.top.value = "auto" m.top.value = "auto"
return return
else else
checkedState = [false, true, true, true, true, true, true] checkedState = NewCheckedState(false, true)
m.lastCheckedState = checkedState m.lastCheckedState = checkedState
m.checkList.checkedState = checkedState m.checkList.checkedState = checkedState
m.top.value = "1080p,720p,480p,360p,240p,144p" m.top.value = AllQualitiesValue()
return return
end if end if
end if end if
@@ -128,7 +165,7 @@ function OnCheckedStateChange() as void
end for end for
if values.Count() = 0 if values.Count() = 0
checkedState = [true, false, false, false, false, false, false] checkedState = NewCheckedState(true, false)
m.lastCheckedState = checkedState m.lastCheckedState = checkedState
m.checkList.checkedState = checkedState m.checkList.checkedState = checkedState
m.top.value = "auto" m.top.value = "auto"
@@ -13,8 +13,8 @@
</Rectangle> </Rectangle>
<Rectangle <Rectangle
width="780" width="780"
height="600" height="640"
translation="[250,60]" translation="[250,40]"
color="#242424"> color="#242424">
<CheckList <CheckList
id="checkList" id="checkList"
@@ -43,13 +43,13 @@
iconVisible="false" iconVisible="false"
text="Save" text="Save"
padding="[30,30]" padding="[30,30]"
translation="[340,500]" /> translation="[340,555]" />
<ButtonEx <ButtonEx
id="closeButton" id="closeButton"
iconVisible="false" iconVisible="false"
text="Close" text="Close"
padding="[30,30]" padding="[30,30]"
translation="[496,500]" /> translation="[496,555]" />
</Rectangle> </Rectangle>
</children> </children>
</component> </component>
@@ -32,7 +32,7 @@
numColumns="1" numColumns="1"
numRows="10" numRows="10"
vertFocusAnimationStyle="floatingFocus" vertFocusAnimationStyle="floatingFocus"
translation="[40,100]" translation="[40,90]"
focusBitmapUri="pkg:/images/focus-glow-padding-19.9.png" /> focusBitmapUri="pkg:/images/focus-glow-padding-19.9.png" />
<ButtonEx <ButtonEx
@@ -40,13 +40,13 @@
iconVisible="false" iconVisible="false"
text="Save" text="Save"
padding="[30,30]" padding="[30,30]"
translation="[340,500]" /> translation="[340,520]" />
<ButtonEx <ButtonEx
id="closeButton" id="closeButton"
iconVisible="false" iconVisible="false"
text="Close" text="Close"
padding="[30,30]" padding="[30,30]"
translation="[496,500]" /> translation="[496,520]" />
</Rectangle> </Rectangle>
</children> </children>
</component> </component>
@@ -1,5 +1,6 @@
import "pkg:/components/Web/WebServer/Http/HttpUtils.bs" import "pkg:/components/Web/WebServer/Http/HttpUtils.bs"
import "pkg:/source/services/XmlObject.bs" import "pkg:/source/services/XmlObject.bs"
import "pkg:/source/utils/CodecCapabilities.bs"
import "pkg:/source/utils/Logging.bs" import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/StringUtils.bs" import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/UrlUtils.bs" import "pkg:/source/utils/UrlUtils.bs"
@@ -14,6 +15,7 @@ class DashManifest
' Backend the metadata came from, echoed onto every live-seg URL so the ' Backend the metadata came from, echoed onto every live-seg URL so the
' DashRouter cache keys on it without reading the prefs node. Set by DashRouter. ' DashRouter cache keys on it without reading the prefs node. Set by DashRouter.
public liveBackend as string = "" public liveBackend as string = ""
private canDecodeAv1Cache as dynamic
function new(invidiousInstance as string, disableAutoDubbed = false as boolean) function new(invidiousInstance as string, disableAutoDubbed = false as boolean)
m.invidiousInstance = invidiousInstance m.invidiousInstance = invidiousInstance
@@ -64,8 +66,11 @@ class DashManifest
videoGroups = groupings.video videoGroups = groupings.video
filteredVideoGroups = m.FilterVideoGroups(videoGroups, qualityFilter) filteredVideoGroups = m.FilterVideoGroups(videoGroups, qualityFilter)
if filteredVideoGroups.Count() = 0 and videoGroups.Count() > 0 ' The player skips video sets it can't play (webm container, undecodable codec).
LogWarnNoTelemetry("No video streams found using quality filter:", qualityFilter, "Falling back to all video streams") ' A filter that leaves only such sets - e.g. 2160p-only when the 4K streams are
' VP9/webm - would play audio with no video, so fall back to all streams.
if not m.HasPlayableVideoGroup(filteredVideoGroups) and videoGroups.Count() > 0
LogWarnNoTelemetry("No playable video streams using quality filter:", qualityFilter, "Falling back to all video streams")
filteredVideoGroups = videoGroups filteredVideoGroups = videoGroups
end if end if
@@ -101,31 +106,23 @@ class DashManifest
} }
nowUtc = "" nowUtc = ""
if isLive if isLive
' Dynamic (live) manifest: the player derives the current segment from
' wall-clock against availabilityStartTime, and the duration-based
' SegmentTemplate (see GenerateSegmentInformation) auto-extends as the
' stream advances. timeShiftBufferDepth exposes the DVR window.
segmentSec = Cint(m.GetLiveFragmentDurationMs(metadata) / 1000.0)
if segmentSec < 1
segmentSec = 1
end if
dvrWindowSec = ValidInt(metadata.liveDvrWindowSec) dvrWindowSec = ValidInt(metadata.liveDvrWindowSec)
mpdAttributes["profiles"] = "urn:mpeg:dash:profile:isoff-live:2011" mpdAttributes["profiles"] = "urn:mpeg:dash:profile:isoff-live:2011"
mpdAttributes["type"] = "dynamic" mpdAttributes["type"] = "dynamic"
' Roku won't track the live edge from wall-clock unless it's handed an ' Roku needs an authoritative "now" to track the live edge from wall-clock; UTCTiming +
' authoritative "now": without it, it anchors to the Period start ' publishTime carry the current UTC, restamped each refresh.
' (availabilityStartTime) and the playhead sits ~stream-age behind. A
' direct UTCTiming + a fresh publishTime (both = current UTC, restamped on
' every refresh) give it that anchor so it computes the real live edge.
nowUtc = CreateObject("roDateTime").ToISOString() nowUtc = CreateObject("roDateTime").ToISOString()
mpdAttributes["publishTime"] = nowUtc mpdAttributes["publishTime"] = nowUtc
mpdAttributes["minimumUpdatePeriod"] = `PT${segmentSec}S` ' 20s: the duration SegmentTemplate extrapolates the edge between refreshes.
mpdAttributes["suggestedPresentationDelay"] = `PT${segmentSec * 3}S` mpdAttributes["minimumUpdatePeriod"] = "PT20S"
if not StringUtils.IsNullOrEmpty(metadata.liveAvailabilityStartUtc) ' Cushion already lives in availabilityStartTime; present at minBufferTime.
mpdAttributes["availabilityStartTime"] = metadata.liveAvailabilityStartUtc mpdAttributes["suggestedPresentationDelay"] = mpdAttributes["minBufferTime"]
if not StringUtils.IsNullOrEmpty(metadata.liveCushionedAvailabilityStartUtc)
mpdAttributes["availabilityStartTime"] = metadata.liveCushionedAvailabilityStartUtc
end if end if
if dvrWindowSec > 0 if dvrWindowSec > 0
mpdAttributes["timeShiftBufferDepth"] = `PT${dvrWindowSec}S` ' Seekable range = window - cushion; the player's DVR floor uses the same value.
mpdAttributes["timeShiftBufferDepth"] = `PT${ValidInt(metadata.liveSeekableWindowSec)}S`
else else
LogWarn("Live stream has no DVR window; omitting timeShiftBufferDepth (live seek may fail). videoId:", metadata.videoId) LogWarn("Live stream has no DVR window; omitting timeShiftBufferDepth (live seek may fail). videoId:", metadata.videoId)
end if end if
@@ -135,9 +132,7 @@ class DashManifest
mpdAttributes["mediaPresentationDuration"] = `PT${duration}S` mpdAttributes["mediaPresentationDuration"] = `PT${duration}S`
end if end if
' Dynamic (live) manifests need an explicit Period start so the player can ' Live needs an explicit Period start to anchor the timeline against availabilityStartTime.
' anchor the timeline against availabilityStartTime; static keeps the
' attribute-less Period it has always used.
periodAttributes = {} periodAttributes = {}
if isLive if isLive
periodAttributes["start"] = "PT0S" periodAttributes["start"] = "PT0S"
@@ -331,6 +326,30 @@ class DashManifest
return filteredGroups return filteredGroups
end function end function
function HasPlayableVideoGroup(videoGroups as object) as boolean
for each group in videoGroups
mimeType = ValidString(group[0].type)
' DASH chunks must be fragmented MP4: the player never picks webm sets.
if not mimeType.startsWith("video/mp4")
continue for
end if
if mimeType.inStr("avc1") <> -1
return true
end if
if mimeType.inStr("av01") <> -1 and m.CanDecodeAv1()
return true
end if
end for
return false
end function
function CanDecodeAv1() as boolean
if m.canDecodeAv1Cache = invalid
m.canDecodeAv1Cache = CodecCapabilities.CanDecodeAv1()
end if
return m.canDecodeAv1Cache
end function
function IsVideoFormatIncluded(stream as object, qualityFilter as object) as boolean function IsVideoFormatIncluded(stream as object, qualityFilter as object) as boolean
if qualityFilter.Count() = 0 if qualityFilter.Count() = 0
return true return true
@@ -636,7 +655,7 @@ class DashManifest
' The `v` (video id) lets the proxy cache the per-video format lookup. ' The `v` (video id) lets the proxy cache the per-video format lookup.
segBase = `${m.liveSegmentBaseUrl}/api/dash/live-seg?v=${metadata.videoId}&itag=${stream.itag}&backend=${m.liveBackend}` segBase = `${m.liveSegmentBaseUrl}/api/dash/live-seg?v=${metadata.videoId}&itag=${stream.itag}&backend=${m.liveBackend}`
xml.EmptyNode("SegmentTemplate", { xml.EmptyNode("SegmentTemplate", {
"initialization": `${segBase}&sq=init` "initialization": `${segBase}&init=true`
"media": `${segBase}&sq=$Number$` "media": `${segBase}&sq=$Number$`
"timescale": "1000" "timescale": "1000"
"duration": durationMs "duration": durationMs
@@ -11,15 +11,17 @@ const INNERTUBE_IOS_USER_AGENT = "com.google.ios.youtube/21.16.2 (iPhone16,2; U;
const INNERTUBE_WEB_BROWSER_NAME = "Chrome" const INNERTUBE_WEB_BROWSER_NAME = "Chrome"
const INNERTUBE_WEB_BROWSER_VERSION = "147.0.0.0" const INNERTUBE_WEB_BROWSER_VERSION = "147.0.0.0"
const INNERTUBE_WEB_CLIENT_NAME = "1" const INNERTUBE_WEB_CLIENT_NAME = "1"
const INNERTUBE_WEB_CLIENT_VERSION = "2.20260424.01.00" const INNERTUBE_WEB_CLIENT_VERSION = "2.20260612.01.00"
const INNERTUBE_WEB_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36" const INNERTUBE_WEB_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36"
const INNERTUBE_TV_BROWSER_NAME = "SamsungBrowser" const INNERTUBE_TV_BROWSER_NAME = "SamsungBrowser"
const INNERTUBE_TV_BROWSER_VERSION = "9.2" const INNERTUBE_TV_BROWSER_VERSION = "9.2"
const INNERTUBE_TV_CLIENT_NAME = "2" const INNERTUBE_TV_CLIENT_NAME = "2"
const INNERTUBE_TV_CLIENT_VERSION = "7.20260422.12.00" const INNERTUBE_TV_CLIENT_VERSION = "7.20260611.00.00"
const INNERTUBE_TV_DEVICE_MAKE = "Samsung" const INNERTUBE_TV_DEVICE_MAKE = "Samsung"
const INNERTUBE_TV_DEVICE_MODEL = "SmartTV" const INNERTUBE_TV_DEVICE_MODEL = "SmartTV"
const INNERTUBE_TV_OS_NAME = "Tizen" const INNERTUBE_TV_OS_NAME = "Tizen"
const INNERTUBE_TV_OS_VERSION = "4.0.0.2" const INNERTUBE_TV_OS_VERSION = "4.0.0.2"
const INNERTUBE_TV_USER_AGENT = "Mozilla/5.0(SMART-TV; Linux; Tizen 4.0.0.2) AppleWebkit/605.1.15 (KHTML, like Gecko) SamsungBrowser/9.2 TV Safari/605.1.15" const INNERTUBE_TV_USER_AGENT = "Mozilla/5.0(SMART-TV; Linux; Tizen 4.0.0.2) AppleWebkit/605.1.15 (KHTML, like Gecko) SamsungBrowser/9.2 TV Safari/605.1.15"
const INNERTUBE_TV_CLIENT_VERSION_DOWNGRADED = "5.20260114"
@@ -8,6 +8,7 @@ namespace Innertube
Web = "WEB" Web = "WEB"
IOS = "IOS" IOS = "IOS"
Tv = "TV" Tv = "TV"
TvDowngraded = "TV_DOWNGRADED"
end enum end enum
function CreateHeaders(client as Innertube.ClientType) as object function CreateHeaders(client as Innertube.ClientType) as object
@@ -35,6 +36,14 @@ namespace Innertube
"x-youtube-client-name": INNERTUBE_TV_CLIENT_NAME "x-youtube-client-name": INNERTUBE_TV_CLIENT_NAME
"x-youtube-client-version": INNERTUBE_TV_CLIENT_VERSION "x-youtube-client-version": INNERTUBE_TV_CLIENT_VERSION
} }
else if client = ClientType.TvDowngraded
return {
"accept": "*/*"
"accept-language": "*"
"user-agent": INNERTUBE_TV_USER_AGENT
"x-youtube-client-name": INNERTUBE_TV_CLIENT_NAME
"x-youtube-client-version": INNERTUBE_TV_CLIENT_VERSION_DOWNGRADED
}
else else
throw "Invalid client type" throw "Invalid client type"
end if end if
@@ -46,8 +55,8 @@ namespace Innertube
contextClient = CreateContextClientWeb(deviceInfo) contextClient = CreateContextClientWeb(deviceInfo)
else if client = ClientType.IOS else if client = ClientType.IOS
contextClient = CreateContextClientIOS(deviceInfo) contextClient = CreateContextClientIOS(deviceInfo)
else if client = ClientType.Tv else if client = ClientType.Tv or client = ClientType.TvDowngraded
contextClient = CreateContextClientTv(deviceInfo) contextClient = CreateContextClientTv(deviceInfo, client)
else else
throw "Invalid client type" throw "Invalid client type"
end if end if
@@ -58,8 +67,8 @@ namespace Innertube
accessToken = OptionUtils.Get(options, "accessToken") accessToken = OptionUtils.Get(options, "accessToken")
videoId = OptionUtils.Get(options, "videoId") videoId = OptionUtils.Get(options, "videoId")
useAccessToken = client = Innertube.ClientType.TV and not StringUtils.IsNullOrEmpty(accessToken) useAccessToken = (client = ClientType.Tv or client = ClientType.TvDowngraded) and not StringUtils.IsNullOrEmpty(accessToken)
useCtt = client = Innertube.ClientType.TV and IsAssociativeArray(credentialTransferToken) and not StringUtils.IsNullOrEmpty(videoId) useCtt = (client = ClientType.Tv or client = ClientType.TvDowngraded) and IsAssociativeArray(credentialTransferToken) and not StringUtils.IsNullOrEmpty(videoId)
context = { context = {
"client": contextClient "client": contextClient
@@ -154,7 +163,11 @@ namespace Innertube
} }
end function end function
function CreateContextClientTv(deviceInfo as object) as object function CreateContextClientTv(deviceInfo as object, client as Innertube.ClientType) as object
tvClientVersion = INNERTUBE_TV_CLIENT_VERSION
if client = ClientType.TvDowngraded
tvClientVersion = INNERTUBE_TV_CLIENT_VERSION_DOWNGRADED
end if
return { return {
"hl": GetCurrentLocale(deviceInfo) "hl": GetCurrentLocale(deviceInfo)
"gl": GetContentRegion(deviceInfo) "gl": GetContentRegion(deviceInfo)
@@ -163,7 +176,7 @@ namespace Innertube
"deviceModel": INNERTUBE_TV_DEVICE_MODEL "deviceModel": INNERTUBE_TV_DEVICE_MODEL
"userAgent": INNERTUBE_TV_USER_AGENT "userAgent": INNERTUBE_TV_USER_AGENT
"clientName": "TVHTML5" "clientName": "TVHTML5"
"clientVersion": INNERTUBE_TV_CLIENT_VERSION "clientVersion": tvClientVersion
"osName": INNERTUBE_TV_OS_NAME "osName": INNERTUBE_TV_OS_NAME
"osVersion": INNERTUBE_TV_OS_VERSION "osVersion": INNERTUBE_TV_OS_VERSION
"originalUrl": "https://www.youtube.com/tv" "originalUrl": "https://www.youtube.com/tv"
@@ -15,6 +15,9 @@ import "pkg:/source/utils/ObjectUtils.bs"
import "pkg:/source/utils/OptionUtils.bs" import "pkg:/source/utils/OptionUtils.bs"
import "pkg:/source/utils/TimeUtils.bs" import "pkg:/source/utils/TimeUtils.bs"
' DEBUG-only: force the downgrade retry on every non-live VOD.
#const DEBUG_FORCE_SABR_DOWNGRADE = false
namespace InnertubeService namespace InnertubeService
function GetVideoMetadata(videoId as string, options = invalid as object) as object function GetVideoMetadata(videoId as string, options = invalid as object) as object
@@ -38,11 +41,13 @@ namespace InnertubeService
playerResponseJson = invalid playerResponseJson = invalid
client = Innertube.ClientType.Tv client = Innertube.ClientType.Tv
totalPlayerRequests = 0 totalPlayerRequests = 0
triedReloadRefresh = false
while true while true
' We shouldn't be making more than 2 requests: ' We shouldn't be making more than 3 requests:
' 1. Make request with TV client. ' 1. Make request with TV client.
' 2. Make request, but STS_MISMATCH error -> retry with new STS. ' 2. Make request, but STS_MISMATCH error -> retry with new STS.
if totalPlayerRequests >= 2 ' 3. useServerDrivenAbr -> retry with downgraded TV client version to recover format URLs.
if totalPlayerRequests >= 3
LogError("Too many player requests, aborting.") LogError("Too many player requests, aborting.")
return { return {
error: "Too many player requests" error: "Too many player requests"
@@ -50,7 +55,7 @@ namespace InnertubeService
end if end if
totalPlayerRequests += 1 totalPlayerRequests += 1
playerRequest = Innertube.CreatePlayerRequest(client, options) playerRequest = Innertube.CreatePlayerRequest(client, options)
if not StringUtils.IsNullOrEmpty(accessToken) and client = Innertube.ClientType.Tv if not StringUtils.IsNullOrEmpty(accessToken) and (client = Innertube.ClientType.Tv or client = Innertube.ClientType.TvDowngraded)
playerRequest.Header("Authorization", "Bearer " + accessToken) playerRequest.Header("Authorization", "Bearer " + accessToken)
end if end if
playerRequest.Cancellation(cancellation) playerRequest.Cancellation(cancellation)
@@ -76,6 +81,15 @@ namespace InnertubeService
playerResponseJson = playerResponse.Json() playerResponseJson = playerResponse.Json()
' Under server-driven ABR the TV client can withhold every adaptive format URL (stuck
' at 360p); the downgraded TV client is not served SABR. Retry once with it.
if client = Innertube.ClientType.Tv and IsSabrLocked(playerResponseJson)
client = Innertube.ClientType.TvDowngraded
continue while
else if client = Innertube.ClientType.TvDowngraded and not HasUsableAdaptiveUrl(playerResponseJson)
LogError("Downgraded TV client did not recover SABR-withheld format URLs")
end if
parsedResponse = Innertube.ParseInnertubePlayerResponse(playerRequest, playerResponse, client, cancellation) parsedResponse = Innertube.ParseInnertubePlayerResponse(playerRequest, playerResponse, client, cancellation)
if parsedResponse.error = invalid if parsedResponse.error = invalid
@@ -86,6 +100,11 @@ namespace InnertubeService
if parsedResponse.errorCode = "STS_MISMATCH" if parsedResponse.errorCode = "STS_MISMATCH"
LogInfo("STS_MISMATCH error, retrying...") LogInfo("STS_MISMATCH error, retrying...")
continue while continue while
else if parsedResponse.errorCode = "RELOAD_PAGE" and not triedReloadRefresh
triedReloadRefresh = true
LogInfo("RELOAD_PAGE: clearing stale STS cache and retrying...")
DeleteFile("tmp:/sts_cache.json")
continue while
else if parsedResponse.errorCode = "MISSING_FORMAT_FIELD" else if parsedResponse.errorCode = "MISSING_FORMAT_FIELD"
useServerDrivenAbr = `${ObjectUtils.Dig(playerResponseJson, ["playerConfig", "mediaCommonConfig", "useServerDrivenAbr"])}` useServerDrivenAbr = `${ObjectUtils.Dig(playerResponseJson, ["playerConfig", "mediaCommonConfig", "useServerDrivenAbr"])}`
LogTelemetryEvent({ LogTelemetryEvent({
@@ -126,6 +145,39 @@ namespace InnertubeService
return parsedResponse return parsedResponse
end function end function
' True when the TV client's response is SABR-locked: server-driven ABR signaled with no usable
' adaptive URL (non-live VOD with streamingData).
function IsSabrLocked(playerResponseJson as object) as boolean
if not IsAssociativeArray(ObjectUtils.Dig(playerResponseJson, ["streamingData"]))
return false
end if
if ValidBool(ObjectUtils.Dig(playerResponseJson, ["videoDetails", "isLive"]))
return false
end if
serverDrivenAbr = ValidBool(ObjectUtils.Dig(playerResponseJson, ["playerConfig", "mediaCommonConfig", "useServerDrivenAbr"]))
locked = serverDrivenAbr and not HasUsableAdaptiveUrl(playerResponseJson)
#if DEBUG
#if DEBUG_FORCE_SABR_DOWNGRADE
locked = true
#end if
#end if
return locked
end function
' True if any adaptive format carries a playable field (url / signatureCipher / cipher).
function HasUsableAdaptiveUrl(playerResponseJson as object) as boolean
adaptiveFormats = ObjectUtils.Dig(playerResponseJson, ["streamingData", "adaptiveFormats"])
if not IsArray(adaptiveFormats)
return false
end if
for each format in adaptiveFormats
if IsAssociativeArray(format) and (not StringUtils.IsNullOrEmpty(format["url"]) or not StringUtils.IsNullOrEmpty(format["signatureCipher"]) or not StringUtils.IsNullOrEmpty(format["cipher"]))
return true
end if
end for
return false
end function
function AwaitAndParseNextResponse(fetchNext as boolean, raw as boolean, parsedResponse as object, nextRequest as object) as object function AwaitAndParseNextResponse(fetchNext as boolean, raw as boolean, parsedResponse as object, nextRequest as object) as object
if not fetchNext if not fetchNext
return parsedResponse return parsedResponse
@@ -8,6 +8,10 @@ import "pkg:/source/utils/UrlUtils.bs"
' under INT32_MAX (~24.8 days at timescale=1000). YouTube caps live DVR at 12h. ' under INT32_MAX (~24.8 days at timescale=1000). YouTube caps live DVR at 12h.
const LIVE_MAX_DVR_WINDOW_SEC = 43200 const LIVE_MAX_DVR_WINDOW_SEC = 43200
' Hold the live edge this many fragments behind the head so a momentary edge-miss refetches
' instead of erroring. Baked into liveCushionedAvailabilityStartUtc. 0 = ride the head.
const LIVE_EDGE_CUSHION_SEGMENTS = 2
namespace Innertube namespace Innertube
' Live streams come back with no hlsManifestUrl/dashManifestUrl, just ' Live streams come back with no hlsManifestUrl/dashManifestUrl, just
@@ -109,12 +113,6 @@ namespace Innertube
windowSec = headTimeSec windowSec = headTimeSec
end if end if
astDate = CreateObject("roDateTime")
astDate.FromSeconds(nowSec - windowSec)
parsedResponse["liveHeadSeqnum"] = headSeqnum
parsedResponse["liveAvailabilityStartUtc"] = astDate.ToISOString()
parsedResponse["liveDvrWindowSec"] = windowSec
' Effective per-fragment duration, derived from the stream's own counters. ' Effective per-fragment duration, derived from the stream's own counters.
' YouTube's reported targetDurationSec is unreliable for long-running streams ' YouTube's reported targetDurationSec is unreliable for long-running streams
' (observed 5s vs a real ~1.8s cadence); using it desyncs the duration-based ' (observed 5s vs a real ~1.8s cadence); using it desyncs the duration-based
@@ -122,8 +120,33 @@ namespace Innertube
' (404). headTime/headSeqnum is the true average and keeps the manifest's ' (404). headTime/headSeqnum is the true average and keeps the manifest's
' wall-clock -> sq mapping anchored to the same (headTime, headSeqnum) pair ' wall-clock -> sq mapping anchored to the same (headTime, headSeqnum) pair
' that availabilityStartTime is built from. ' that availabilityStartTime is built from.
fragmentDurationMs = 0
if headSeqnum > 0 if headSeqnum > 0
parsedResponse["liveFragmentDurationMs"] = Cint((headTimeSec / headSeqnum) * 1000.0) fragmentDurationMs = Cint((headTimeSec / headSeqnum) * 1000.0)
end if
astSec = nowSec - windowSec
astDate = CreateObject("roDateTime")
astDate.FromSeconds(astSec)
cushionSec = Cint(LIVE_EDGE_CUSHION_SEGMENTS * fragmentDurationMs / 1000.0)
' Younger than the cushion: shifting the anchor past now would break the edge math.
if cushionSec >= windowSec
cushionSec = 0
end if
' Shift the anchor later by the cushion so the computed edge lands a cushion behind the head.
cushionedAstDate = CreateObject("roDateTime")
cushionedAstDate.FromSeconds(astSec + cushionSec)
' Window minus the cushion; the full window would seek below startNumber.
seekableWindowSec = windowSec - cushionSec
parsedResponse["liveHeadSeqnum"] = headSeqnum
' The real (uncushioned) availabilityStartTime, kept for diagnostics.
parsedResponse["liveAvailabilityStartUtc"] = astDate.ToISOString()
parsedResponse["liveCushionedAvailabilityStartUtc"] = cushionedAstDate.ToISOString()
parsedResponse["liveDvrWindowSec"] = windowSec
parsedResponse["liveSeekableWindowSec"] = seekableWindowSec
if fragmentDurationMs > 0
parsedResponse["liveFragmentDurationMs"] = fragmentDurationMs
end if end if
end function end function
@@ -88,6 +88,7 @@ namespace Innertube
"feedFilterChipBarRenderer": ParseFeedFilterChipBarRenderer "feedFilterChipBarRenderer": ParseFeedFilterChipBarRenderer
"chipBarViewModel": ParseChipBarViewModel "chipBarViewModel": ParseChipBarViewModel
"continuationItemRenderer": ParseContinuationItemRenderer "continuationItemRenderer": ParseContinuationItemRenderer
"continuationItemViewModel": ParseContinuationItemViewModel
"appendContinuationItemsAction": ParseAppendContinuationItemsAction "appendContinuationItemsAction": ParseAppendContinuationItemsAction
"reloadContinuationItemsCommand": ParseReloadContinuationItemsCommand "reloadContinuationItemsCommand": ParseReloadContinuationItemsCommand
"gridContinuation": ParseGridContinuation "gridContinuation": ParseGridContinuation
@@ -1103,6 +1104,32 @@ namespace Innertube
return invalid return invalid
end function end function
' The badge overlay has two shapes: thumbnailOverlayBadgeViewModel.thumbnailBadges (older, still
' used on playlist/podcast/album lockups) and thumbnailBottomOverlayViewModel.badges (video lockups)
function GetThumbnailBadgeText(thumbnailViewModel as object) as string
overlays = ObjectUtils.Dig(thumbnailViewModel, ["overlays"])
if not IsArray(overlays)
return ""
end if
for each overlay in overlays
badges = ObjectUtils.Dig(overlay, ["thumbnailBottomOverlayViewModel", "badges"])
if not IsArray(badges)
badges = ObjectUtils.Dig(overlay, ["thumbnailOverlayBadgeViewModel", "thumbnailBadges"])
end if
if IsArray(badges)
for each badge in badges
text = ValidString(ObjectUtils.Dig(badge, ["thumbnailBadgeViewModel", "text"]))
if text <> ""
return text
end if
end for
end if
end for
return ""
end function
function LockupViewModelTypeVideo(nodeData as object, context as object) as object function LockupViewModelTypeVideo(nodeData as object, context as object) as object
videoId = nodeData["contentId"] videoId = nodeData["contentId"]
if not IsString(videoId) if not IsString(videoId)
@@ -1124,7 +1151,7 @@ namespace Innertube
end if end if
end if end if
lengthText = ValidString(ObjectUtils.Dig(thumbnailViewModel, ["overlays", 0, "thumbnailOverlayBadgeViewModel", "thumbnailBadges", 0, "thumbnailBadgeViewModel", "text"])) lengthText = GetThumbnailBadgeText(thumbnailViewModel)
authorId = ObjectUtils.Dig(metadata, ["image", "decoratedAvatarViewModel", "rendererContext", "commandContext", "onTap", "innertubeCommand", "browseEndpoint", "browseId"]) authorId = ObjectUtils.Dig(metadata, ["image", "decoratedAvatarViewModel", "rendererContext", "commandContext", "onTap", "innertubeCommand", "browseEndpoint", "browseId"])
@@ -1155,7 +1182,7 @@ namespace Innertube
"authorId": authorId "authorId": authorId
"lines": lines "lines": lines
"videoThumbnails": videoThumbnails "videoThumbnails": videoThumbnails
"videoCountText": lengthText "lengthText": lengthText
} }
PushFeedItem(video, context) PushFeedItem(video, context)
@@ -1234,7 +1261,7 @@ namespace Innertube
title = ObjectUtils.Dig(metadata, ["title", "content"]) title = ObjectUtils.Dig(metadata, ["title", "content"])
thumbnailViewModel = ObjectUtils.Dig(nodeData, ["contentImage", "collectionThumbnailViewModel", "primaryThumbnail", "thumbnailViewModel"]) thumbnailViewModel = ObjectUtils.Dig(nodeData, ["contentImage", "collectionThumbnailViewModel", "primaryThumbnail", "thumbnailViewModel"])
thumbnail = ObjectUtils.Dig(thumbnailViewModel, ["image", "sources", 0, "url"]) thumbnail = ObjectUtils.Dig(thumbnailViewModel, ["image", "sources", 0, "url"])
videoCountText = ObjectUtils.Dig(thumbnailViewModel, ["overlays", 0, "thumbnailOverlayBadgeViewModel", "thumbnailBadges", 0, "thumbnailBadgeViewModel", "text"]) videoCountText = GetThumbnailBadgeText(thumbnailViewModel)
author = invalid author = invalid
authorId = invalid authorId = invalid
@@ -1283,7 +1310,7 @@ namespace Innertube
title = ObjectUtils.Dig(metadata, ["title", "content"]) title = ObjectUtils.Dig(metadata, ["title", "content"])
thumbnailViewModel = ObjectUtils.Dig(nodeData, ["contentImage", "collectionThumbnailViewModel", "primaryThumbnail", "thumbnailViewModel"]) thumbnailViewModel = ObjectUtils.Dig(nodeData, ["contentImage", "collectionThumbnailViewModel", "primaryThumbnail", "thumbnailViewModel"])
thumbnail = ObjectUtils.Dig(thumbnailViewModel, ["image", "sources", 0, "url"]) thumbnail = ObjectUtils.Dig(thumbnailViewModel, ["image", "sources", 0, "url"])
videoCountText = ObjectUtils.Dig(thumbnailViewModel, ["overlays", 0, "thumbnailOverlayBadgeViewModel", "thumbnailBadges", 0, "thumbnailBadgeViewModel", "text"]) videoCountText = GetThumbnailBadgeText(thumbnailViewModel)
author = invalid author = invalid
authorId = invalid authorId = invalid
@@ -1318,7 +1345,7 @@ namespace Innertube
title = ObjectUtils.Dig(metadata, ["title", "content"]) title = ObjectUtils.Dig(metadata, ["title", "content"])
thumbnailViewModel = ObjectUtils.Dig(nodeData, ["contentImage", "collectionThumbnailViewModel", "primaryThumbnail", "thumbnailViewModel"]) thumbnailViewModel = ObjectUtils.Dig(nodeData, ["contentImage", "collectionThumbnailViewModel", "primaryThumbnail", "thumbnailViewModel"])
thumbnail = ObjectUtils.Dig(thumbnailViewModel, ["image", "sources", 0, "url"]) thumbnail = ObjectUtils.Dig(thumbnailViewModel, ["image", "sources", 0, "url"])
videoCountText = ObjectUtils.Dig(thumbnailViewModel, ["overlays", 0, "thumbnailOverlayBadgeViewModel", "thumbnailBadges", 0, "thumbnailBadgeViewModel", "text"]) videoCountText = GetThumbnailBadgeText(thumbnailViewModel)
author = invalid author = invalid
authorId = invalid authorId = invalid
@@ -1824,6 +1851,19 @@ namespace Innertube
return invalid return invalid
end function end function
function ParseContinuationItemViewModel(nodeData as object, context as object) as object
if not StringUtils.IsNullOrEmpty(context.currentFeed.continuation)
return invalid
end if
continuation = ObjectUtils.Dig(nodeData, ["continuationCommand", "innertubeCommand", "continuationCommand", "token"])
if IsString(continuation)
context.currentFeed.continuation = continuation
end if
return invalid
end function
function ParseContinuationItemRenderer(nodeData as object, context as object) as object function ParseContinuationItemRenderer(nodeData as object, context as object) as object
' In Playlists there are 2 continuation items: ' In Playlists there are 2 continuation items:
' - The first one (innermost) we encounter is the continuation for the next page of videos ' - The first one (innermost) we encounter is the continuation for the next page of videos
@@ -16,13 +16,13 @@ namespace Innertube
accessToken = OptionUtils.Get(options, "accessToken") accessToken = OptionUtils.Get(options, "accessToken")
cpn = InnertubeService.CreateClientPlaybackNonce() cpn = InnertubeService.CreateClientPlaybackNonce()
useAccessToken = client = Innertube.ClientType.TV and not StringUtils.IsNullOrEmpty(accessToken) useAccessToken = (client = Innertube.ClientType.Tv or client = Innertube.ClientType.TvDowngraded) and not StringUtils.IsNullOrEmpty(accessToken)
deviceInfo = CreateObject("roDeviceInfo") deviceInfo = CreateObject("roDeviceInfo")
context = Innertube.CreateContext(client, deviceInfo, options) context = Innertube.CreateContext(client, deviceInfo, options)
if client = Innertube.ClientType.TV if client = Innertube.ClientType.Tv or client = Innertube.ClientType.TvDowngraded
referer = "https://www.youtube.com/tv#/watch?v=" + videoId referer = "https://www.youtube.com/tv#/watch?v=" + videoId
else else
referer = "https://www.youtube.com/watch?v=" + videoId referer = "https://www.youtube.com/watch?v=" + videoId
@@ -77,6 +77,9 @@ namespace Innertube
error = ParsePlayerResponseForError(payload, playerRequest) error = ParsePlayerResponseForError(payload, playerRequest)
if error <> "" if error <> ""
parsedResponse["error"] = error parsedResponse["error"] = error
if PlayerResponseRequiresPageReload(payload)
parsedResponse["errorCode"] = "RELOAD_PAGE"
end if
return parsedResponse return parsedResponse
end if end if
@@ -99,7 +102,7 @@ namespace Innertube
adaptiveFormats = ValidArray(ObjectUtils.Dig(payload, ["streamingData", "adaptiveFormats"])) adaptiveFormats = ValidArray(ObjectUtils.Dig(payload, ["streamingData", "adaptiveFormats"]))
formats = ValidArray(ObjectUtils.Dig(payload, ["streamingData", "formats"])) formats = ValidArray(ObjectUtils.Dig(payload, ["streamingData", "formats"]))
error = DecipherUrls(formats, adaptiveFormats, playerRequest.signatureTimestamp, cancellation) error = DecipherUrls(formats, adaptiveFormats, playerRequest.signatureTimestamp, cancellation, client)
if error <> invalid if error <> invalid
parsedResponse["error"] = error.error parsedResponse["error"] = error.error
if error.DoesExist("errorCode") if error.DoesExist("errorCode")
@@ -231,6 +234,11 @@ namespace Innertube
return errorLines.Join(`\n`) return errorLines.Join(`\n`)
end function end function
function PlayerResponseRequiresPageReload(payload as object) as boolean
signal = ObjectUtils.Dig(payload, ["playabilityStatus", "errorScreen", "playerErrorMessageRenderer", "proceedButton", "buttonRenderer", "command", "signalAction", "signal"])
return IsString(signal) and signal = "RELOAD_PAGE"
end function
function ParseStoryboards(payload as object, lengthSeconds as integer) as object function ParseStoryboards(payload as object, lengthSeconds as integer) as object
storyboard = ObjectUtils.Dig(payload, ["storyboards", "playerLiveStoryboardSpecRenderer", "spec"]) storyboard = ObjectUtils.Dig(payload, ["storyboards", "playerLiveStoryboardSpecRenderer", "spec"])
if IsString(storyboard) if IsString(storyboard)
@@ -336,7 +344,15 @@ namespace Innertube
' vtt has "align:start position:0%" on auto-generated captions ' vtt has "align:start position:0%" on auto-generated captions
' srt has large spacing between lines on auto-generated captions ' srt has large spacing between lines on auto-generated captions
' ttml has default styling, with smaller font than the default size ' ttml has default styling, with smaller font than the default size
queryComponents["fmt"] = "ttml" ' CEA-608 broadcast channels (CC1-CC4) encode their paint-on reveal as
' per-segment timed spans; Roku's ttml renderer stacks each span on its own
' line (vertical text). vtt expresses the same timing inline, so it wraps.
captionName = queryComponents["name"]
if captionName = "CC1" or captionName = "CC2" or captionName = "CC3" or captionName = "CC4"
queryComponents["fmt"] = "vtt"
else
queryComponents["fmt"] = "ttml"
end if
baseUrl = UrlUtils.SetQueryParams(baseUrl, queryComponents) baseUrl = UrlUtils.SetQueryParams(baseUrl, queryComponents)
languageCode = track["languageCode"] languageCode = track["languageCode"]
@@ -483,7 +499,7 @@ namespace Innertube
return json["sts"] return json["sts"]
end function end function
function DecipherUrls(formats as object, adaptiveFormats as object, signatureTimestamp as dynamic, cancellation as object) as object function DecipherUrls(formats as object, adaptiveFormats as object, signatureTimestamp as dynamic, cancellation as object, client = invalid as dynamic) as object
if signatureTimestamp = invalid if signatureTimestamp = invalid
' No need to decipher if signatureTimestamp is not available ' No need to decipher if signatureTimestamp is not available
return invalid return invalid
@@ -565,7 +581,7 @@ namespace Innertube
for i = 0 to decipheredFormats.Count() - 1 for i = 0 to decipheredFormats.Count() - 1
fmt = formats[i] fmt = formats[i]
decipheredFmt = decipheredFormats[i] decipheredFmt = decipheredFormats[i]
fmt["url"] = ResetUrlClientVersion(decipheredFmt["url"]) fmt["url"] = ResetUrlClientVersion(decipheredFmt["url"], client)
end for end for
decipheredAdaptiveFormats = json["adaptiveFormats"] decipheredAdaptiveFormats = json["adaptiveFormats"]
@@ -579,7 +595,7 @@ namespace Innertube
for i = 0 to decipheredAdaptiveFormats.Count() - 1 for i = 0 to decipheredAdaptiveFormats.Count() - 1
fmt = adaptiveFormats[i] fmt = adaptiveFormats[i]
decipheredFmt = decipheredAdaptiveFormats[i] decipheredFmt = decipheredAdaptiveFormats[i]
fmt["url"] = ResetUrlClientVersion(decipheredFmt["url"]) fmt["url"] = ResetUrlClientVersion(decipheredFmt["url"], client)
end for end for
return invalid return invalid
end function end function
@@ -587,7 +603,7 @@ namespace Innertube
' YouTube.js sets cver to hardcoded values that might be different from ' YouTube.js sets cver to hardcoded values that might be different from
' What's used in Playlet. There's no indication that this makes a difference, ' What's used in Playlet. There's no indication that this makes a difference,
' but it makes sense to keep it consistent. ' but it makes sense to keep it consistent.
function ResetUrlClientVersion(url as dynamic) as dynamic function ResetUrlClientVersion(url as dynamic, requestClient = invalid as dynamic) as dynamic
if StringUtils.IsNullOrEmpty(url) if StringUtils.IsNullOrEmpty(url)
return url return url
end if end if
@@ -595,7 +611,11 @@ namespace Innertube
queryComponents = UrlUtils.ParseQueryComponents(url) queryComponents = UrlUtils.ParseQueryComponents(url)
client = ValidString(queryComponents["c"]) client = ValidString(queryComponents["c"])
if client = "TVHTML5" if client = "TVHTML5"
queryComponents["cver"] = INNERTUBE_TV_CLIENT_VERSION if requestClient = Innertube.ClientType.TvDowngraded
queryComponents["cver"] = INNERTUBE_TV_CLIENT_VERSION_DOWNGRADED
else
queryComponents["cver"] = INNERTUBE_TV_CLIENT_VERSION
end if
else if client = "IOS" else if client = "IOS"
queryComponents["cver"] = INNERTUBE_IOS_CLIENT_VERSION queryComponents["cver"] = INNERTUBE_IOS_CLIENT_VERSION
else if client = "WEB" else if client = "WEB"
@@ -1,5 +1,5 @@
' Auto-generated file - do not modify manually ' Auto-generated file - do not modify manually
' md5:1dc03998a561a4b1270454e10a4d7ead ' md5:6966cee321cfa827e09c0f49b10a3fa8
import "pkg:/source/Protobuf/BinaryReader.bs" import "pkg:/source/Protobuf/BinaryReader.bs"
import "pkg:/source/Protobuf/BinaryWriter.bs" import "pkg:/source/Protobuf/BinaryWriter.bs"
@@ -86,6 +86,7 @@ class LoungeApi
commandHandlers[COMMAND_TYPE_STOP_VIDEO] = m.HandleStopVideo commandHandlers[COMMAND_TYPE_STOP_VIDEO] = m.HandleStopVideo
commandHandlers[COMMAND_TYPE_SEEK_TO] = m.HandleSeekTo commandHandlers[COMMAND_TYPE_SEEK_TO] = m.HandleSeekTo
commandHandlers[COMMAND_TYPE_SET_PLAYBACK_SPEED] = m.HandleSetPlaybackSpeed commandHandlers[COMMAND_TYPE_SET_PLAYBACK_SPEED] = m.HandleSetPlaybackSpeed
commandHandlers[COMMAND_TYPE_GET_PLAYBACK_SPEED] = m.HandleGetPlaybackSpeed
for each key in commandHandlers for each key in commandHandlers
m[COMMAND_HANDLER_PREFIX + key] = commandHandlers[key] m[COMMAND_HANDLER_PREFIX + key] = commandHandlers[key]
@@ -508,6 +509,11 @@ class LoungeApi
speed = 1.0 speed = 1.0
end if end if
content = player.content
if content <> invalid and content.live = true
return
end if
currentSpeed = ValidFloat(player.playbackSpeed) currentSpeed = ValidFloat(player.playbackSpeed)
if Abs(currentSpeed - speed) < 0.001 if Abs(currentSpeed - speed) < 0.001
@@ -534,6 +540,27 @@ class LoungeApi
messagesToSend.Push(LoungeMessages.OnPlaybackSpeedChanged(speed, true)) messagesToSend.Push(LoungeMessages.OnPlaybackSpeedChanged(speed, true))
end function end function
function HandleGetPlaybackSpeed(commandId as integer, _commandType as string, _commandArgs as object, messagesToSend as object) as void
player = m.videoQueueNode.player
if player = invalid
return
end if
if not player.hasField("playbackSpeed")
LogWarn("Video node does not support 'playbackSpeed' field on this device, ignoring getPlaybackSpeed command")
return
end if
speed = ValidFloat(player.playbackSpeed)
if speed <= 0
speed = 1.0
end if
message = LoungeMessages.OnPlaybackSpeedChanged(speed)
message["commandId"] = commandId
messagesToSend.Push(message)
end function
function SendMessages(messages as object, loungeData = invalid as object) as void function SendMessages(messages as object, loungeData = invalid as object) as void
if messages.Count() = 0 if messages.Count() = 0
return return
@@ -34,6 +34,7 @@ const COMMAND_TYPE_GET_RECEIVER_STATUS = "getReceiverStatus"
const COMMAND_TYPE_SEND_DEBUG_COMMAND = "sendDebugCommand" const COMMAND_TYPE_SEND_DEBUG_COMMAND = "sendDebugCommand"
const COMMAND_TYPE_SET_AUTOPLAY_MODE = "setAutoplayMode" const COMMAND_TYPE_SET_AUTOPLAY_MODE = "setAutoplayMode"
const COMMAND_TYPE_SET_PLAYBACK_SPEED = "setPlaybackSpeed" const COMMAND_TYPE_SET_PLAYBACK_SPEED = "setPlaybackSpeed"
const COMMAND_TYPE_GET_PLAYBACK_SPEED = "getPlaybackSpeed"
' Special commands ' Special commands
const COMMAND_TYPE_SESSION_ID = "c" const COMMAND_TYPE_SESSION_ID = "c"
const COMMAND_TYPE_G_SESSION_ID = "S" const COMMAND_TYPE_G_SESSION_ID = "S"
@@ -15,16 +15,18 @@ namespace LoungeMessages
return message return message
end function end function
function OnPlaybackSpeedChanged(speed as float, isContentSupportVSP as boolean) as object function OnPlaybackSpeedChanged(speed as float, isContentSupportVSP = invalid as dynamic) as object
message = { message = {
commandType: COMMAND_ON_PLAYBACK_SPEED_CHANGED commandType: COMMAND_ON_PLAYBACK_SPEED_CHANGED
} }
commandArgs = {} commandArgs = {}
commandArgs[FIELD_PLAYBACK_SPEED] = speed commandArgs[FIELD_PLAYBACK_SPEED] = speed
commandArgs[FIELD_PLAYBACK_SPEED_INFO] = FormatJson({ if isContentSupportVSP <> invalid
"playbackSpeed": speed commandArgs[FIELD_PLAYBACK_SPEED_INFO] = FormatJson({
"isContentSupportVSP": isContentSupportVSP "playbackSpeed": speed
}) "isContentSupportVSP": isContentSupportVSP
})
end if
message.commandArgs = commandArgs message.commandArgs = commandArgs
return message return message
end function end function
@@ -178,6 +178,16 @@ function MigrateExistingPreferences(userPrefs as object) as boolean
isDirty = true isDirty = true
end if end if
if userPrefs.__version = 6
' Hook was split out of Preview. Existing users inherit their Preview setting.
categories = userPrefs["sponsorblock.categories"]
if IsAssociativeArray(categories) and not categories.DoesExist("hook") and IsAssociativeArray(categories["preview"])
categories["hook"] = { option: categories["preview"].option }
end if
userPrefs.__version = 7
isDirty = true
end if
' TODO:P2 handle case where saved preferences version is higher than current version (e.g. user downgraded) ' TODO:P2 handle case where saved preferences version is higher than current version (e.g. user downgraded)
#if DEBUG #if DEBUG
@@ -5,7 +5,7 @@
user prefs saved need to be migrated. If the version is less than the user prefs saved need to be migrated. If the version is less than the
current version, a migration is needed. current version, a migration is needed.
--> -->
<field id="__version" type="integer" value="6" /> <field id="__version" type="integer" value="7" />
<field id="prefsModel" type="array" /> <field id="prefsModel" type="array" />
<field id="preferenceFields" type="assocarray" /> <field id="preferenceFields" type="assocarray" />
<function name="GetUserPreferences" /> <function name="GetUserPreferences" />
@@ -24,14 +24,18 @@ function LoadProfilesFromRegistry()
' Step 1: Load user profiles from registry ' Step 1: Load user profiles from registry
userProfiles = RegistryUtils.Read(RegistryUtils.USER_PROFILES) userProfiles = RegistryUtils.Read(RegistryUtils.USER_PROFILES)
if userProfiles <> invalid
userProfiles = StringUtils.ParseJsonSafe(userProfiles)
if userProfiles = invalid
LogError("user_profiles registry value is corrupt (unparseable); resetting to empty")
end if
end if
if userProfiles = invalid if userProfiles = invalid
userProfiles = { userProfiles = {
profiles: [] profiles: []
currentProfile: invalid currentProfile: invalid
} }
else
userProfiles = StringUtils.ParseJsonSafe(userProfiles)
end if end if
' Step 2: Migrate existing profiles to new format (if needed) ' Step 2: Migrate existing profiles to new format (if needed)
@@ -92,7 +92,7 @@ end function
function GetOptionForSegment(segment as object, categories as object) as string function GetOptionForSegment(segment as object, categories as object) as string
category = categories[segment.category] category = categories[segment.category]
if not IsAssociativeArray(category) if not IsAssociativeArray(category)
return false return SponsorBlock.SegmentAction.Disable
end if end if
option = category.option option = category.option
@@ -74,8 +74,8 @@ namespace SponsorBlock
return invalid return invalid
end if end if
' categories = ["sponsor", "selfpromo", "interaction", "intro", "outro", "preview", "music_offtopic", "poi_highlight", "filler", "exclusive_access"] ' categories = ["sponsor", "selfpromo", "interaction", "intro", "outro", "preview", "hook", "music_offtopic", "poi_highlight", "filler", "exclusive_access"]
categories = ["sponsor", "selfpromo", "interaction", "intro", "outro", "preview", "music_offtopic", "poi_highlight", "filler"] categories = ["sponsor", "selfpromo", "interaction", "intro", "outro", "preview", "hook", "music_offtopic", "poi_highlight", "filler"]
' actionTypes = ["skip", "mute", "chapter", "full", "poi"] ' actionTypes = ["skip", "mute", "chapter", "full", "poi"]
actionTypes = ["skip", "mute", "poi"] actionTypes = ["skip", "mute", "poi"]
@@ -0,0 +1,93 @@
#const DEBUG_THROW_ON_UNKNOWN_EXIT_CODE = true
import "pkg:/components/Telemetry/Sentry.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/Types.bs"
function ReportLastExitCrash() as void
scene = m.top.getScene()
if scene = invalid or not scene.hasField("lastExitInfo")
return
end if
lastExitInfo = scene.lastExitInfo
scene.lastExitInfo = invalid
if not IsAssociativeArray(lastExitInfo)
return
end if
crashExitCodes = {
"EXIT_BRIGHTSCRIPT_CRASH": true
"EXIT_BRIGHTSCRIPT_STOP": true
"EXIT_BRIGHTSCRIPT_UNK_FUNC": true
"EXIT_BRIGHTSCRIPT_TIMEOUT": true
"EXIT_OUT_OF_MEMORY": true
"EXIT_CHANNEL_MEM_LIMIT_FG": true
"EXIT_CHANNEL_MEM_LIMIT_BG": true
"EXIT_SYSTEM_KILL": true
"EXIT_GRAPHICS_NOT_RELEASED": true
"EXIT_DECODER_NOT_RELEASED": true
"EXIT_RUNNING_AFTER_SUSPEND": true
"EXIT_NOT_RESUMED": true
"EXIT_SIGNAL_TIMEOUT": true
"EXIT_APP_ERROR": true
"EXIT_UNKNOWN": false
"EXIT_POWER_MODE": false
"EXIT_DIAL_DELETE": false
"EXIT_IDLE_AUTO_EXIT": false
"EXIT_USER_KILL": false
"EXIT_USER_NAV": false
"EXIT_AM_LOWRESOURCE": false
"EXIT_UNLOADED": false
"EXIT_GUEST_MODE_ENABLED": false
"EXIT_GUEST_MODE_DISABLED": false
"EXIT_GUEST_CHECKOUT": false
"EXIT_OS_UPDATE": false
"EXIT_CHANNEL_UPDATE": false
"EXIT_CHANNEL_SIDELOAD": false
"EXIT_CHANNEL_RESTART": false
"EXIT_TILE_HIDDEN": false
"EXIT_SETTINGS_UPDATE": false
"EXIT_ADDON_DEPENDENCY": false
"EXIT_SOFTFAIL": false
}
exitCode = ValidString(lastExitInfo.exit_code)
#if DEBUG_THROW_ON_UNKNOWN_EXIT_CODE
#if DEBUG
if not crashExitCodes.DoesExist(exitCode)
throw "Unhandled exit code: " + exitCode
end if
#end if
#end if
if crashExitCodes[exitCode] = false
return
end if
message = `[FATAL][LastExit] App crashed: ${exitCode}`
for each key in lastExitInfo
message += `\n${key}: ${ToString(lastExitInfo[key])}`
end for
message = RedactAuthHeaders(message)
Sentry.SendEvents([{
level: "fatal"
message: message
timestamp: ValidString(lastExitInfo.timestamp)
fingerprint: [exitCode]
release: m.release
dist: m.dist
tags: m.tags
userId: m.userId
}])
end function
function RedactAuthHeaders(text as string) as string
authRegex = /Authorization: [^\r\n]*/i
matches = authRegex.MatchAll(text)
for each match in matches
text = text.Replace(match[0], "Authorization: <REDACTED>")
end for
return text
end function
@@ -67,14 +67,13 @@ namespace Sentry
hasAttachments = IsArray(event.attachments) and event.attachments.Count() > 0 hasAttachments = IsArray(event.attachments) and event.attachments.Count() > 0
if (not SUPPORTS_ATTACHMENTS) and hasAttachments if (not SUPPORTS_ATTACHMENTS) and hasAttachments
message += `\nAttachments: (${event.attachments.Count()} files)` extra = {}
for each attachment in event.attachments for each attachment in event.attachments
message += `\nAttachment: ${attachment.filename} (${attachment.content_type})\n${attachment.data}` extra[attachment.filename] = `content_type:${attachment.content_type}\n${attachment.data}`
end for end for
message += `\nEnd of attachments.` eventPayload.extra = extra
end if end if
' TODO:P1 compress if message is larger than 8192
eventPayload.logentry = { eventPayload.logentry = {
formatted: message formatted: message
} }
@@ -1,5 +1,6 @@
#const SUPPORTS_BATCHING = false #const SUPPORTS_BATCHING = false
import "pkg:/components/Telemetry/LastExitCrash.bs"
import "pkg:/components/Telemetry/Sentry.bs" import "pkg:/components/Telemetry/Sentry.bs"
import "pkg:/source/utils/Logging.bs" import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/Types.bs" import "pkg:/source/utils/Types.bs"
@@ -47,6 +48,8 @@ function TelemetryLoop() as void
m.dist = GetDist(m.tags) m.dist = GetDist(m.tags)
m.userId = GetUserId() m.userId = GetUserId()
ReportLastExitCrash()
m.top.observeField("LogInfo", msgPort) m.top.observeField("LogInfo", msgPort)
m.top.observeField("LogWarn", msgPort) m.top.observeField("LogWarn", msgPort)
m.top.observeField("LogError", msgPort) m.top.observeField("LogError", msgPort)
@@ -16,8 +16,9 @@ namespace Lounge
overrides[FIELD_VIDEO_ID] = videoId overrides[FIELD_VIDEO_ID] = videoId
end if end if
nowPlayingMsg = LoungeMessages.NowPlaying(m.top, overrides) nowPlayingMsg = LoungeMessages.NowPlaying(m.top, overrides)
' Sending playback speed to indicate that we will reset it to 1.0 when the content starts playing ' Reset the displayed speed to 1.0 on load. The content's live status (which decides VSP support)
playbackSpeedMsg = LoungeMessages.OnPlaybackSpeedChanged(playbackSpeed, true) ' isn't known yet here, so report only the speed, as the real receiver does for non-change updates.
playbackSpeedMsg = LoungeMessages.OnPlaybackSpeedChanged(playbackSpeed)
m.loungeService.outgoingMessages = [nowPlayingMsg, loungeStateMsg, playbackSpeedMsg] m.loungeService.outgoingMessages = [nowPlayingMsg, loungeStateMsg, playbackSpeedMsg]
end function end function
@@ -69,6 +69,19 @@ namespace Tests
m.assertEqual(anim.control, "start") m.assertEqual(anim.control, "start")
end function end function
@it("a nudge with an out-of-range focusedIndex is a safe no-op")
function _()
m.top.rowFocused = true
m.top.focusedIndex = 5
playAnim = m.top.findNode("PlayPauseButton").findNode("nudgeAnim")
minimizeAnim = m.top.findNode("MinimizeButton").findNode("nudgeAnim")
playAnim.control = "stop"
minimizeAnim.control = "stop"
m.top.nudge = true
m.assertEqual(playAnim.control, "stop")
m.assertEqual(minimizeAnim.control, "stop")
end function
@describe("play/pause icon tracks the play state") @describe("play/pause icon tracks the play state")
@it("shows the pause icon while playing, the play icon while paused") @it("shows the pause icon while playing, the play icon while paused")
@@ -18,7 +18,8 @@
<field id="focusedIndex" type="integer" value="0" /> <field id="focusedIndex" type="integer" value="0" />
<field id="playing" type="boolean" value="true" /> <!-- selects the play vs pause icon --> <field id="playing" type="boolean" value="true" /> <!-- selects the play vs pause icon -->
<field id="buttonCount" type="integer" value="0" /> <!-- read-only: set in Init from m.buttons --> <field id="buttonCount" type="integer" value="0" /> <!-- read-only: set in Init from m.buttons -->
<!-- pulse the focused button's scale nudge (a Left/Right that couldn't move focus). --> <!-- pulse the focused button's scale nudge (a press that couldn't move focus: Left/Right clamped at
the row's ends, Up at the top tier). -->
<field id="nudge" type="boolean" alwaysNotify="true" /> <field id="nudge" type="boolean" alwaysNotify="true" />
</interface> </interface>
<children> <children>
@@ -2,6 +2,7 @@
' INPUT fields, and asserts the rendered child fields: fill clip width, playhead translation, M:SS labels, ' INPUT fields, and asserts the rendered child fields: fill clip width, playhead translation, M:SS labels,
' the raised handle while a transport is active, the glyph swap, and the live layout (Rewind live TV / offset ' the raised handle while a transport is active, the glyph swap, and the live layout (Rewind live TV / offset
' / ● LIVE swap). clippingRect reads back as {x,y,width,height} on the render thread. ' / ● LIVE swap). clippingRect reads back as {x,y,width,height} on the render thread.
import "pkg:/source/utils/Locale.bs"
namespace Tests namespace Tests
@@ -198,7 +199,7 @@ namespace Tests
m.assertEqual(m.top.findNode("remainingLabel").text, "") m.assertEqual(m.top.findNode("remainingLabel").text, "")
' the badge styling: red bullet + bold size-30 LIVE. blendColor reads back as a signed 32-bit int. ' the badge styling: red bullet + bold size-30 LIVE. blendColor reads back as a signed 32-bit int.
m.AssertBlend(m.top.findNode("bullet").blendColor, &hD53E5AFF) m.AssertBlend(m.top.findNode("bullet").blendColor, &hD53E5AFF)
m.assertEqual(m.top.findNode("liveLabel").text, Tr("LIVE")) m.assertEqual(m.top.findNode("liveLabel").text, Tr(Locale.RowCell.Live))
' the badge is right-aligned to the track end whatever the language ("EN DIRECT" >> "LIVE"). ' the badge is right-aligned to the track end whatever the language ("EN DIRECT" >> "LIVE").
lbl = m.top.findNode("liveLabel") lbl = m.top.findNode("liveLabel")
m.assertTrue(Abs((lbl.translation[0] + lbl.boundingRect().width) - 1144) < 2, "badge right edge pinned to the track end") m.assertTrue(Abs((lbl.translation[0] + lbl.boundingRect().width) - 1144) < 2, "badge right edge pinned to the track end")
@@ -13,7 +13,8 @@
<field id="focusedIconColor" type="color" value="#262626" /> <field id="focusedIconColor" type="color" value="#262626" />
<field id="focused" type="boolean" value="false" /> <field id="focused" type="boolean" value="false" />
<!-- pulse the scale nudge: confirms a press that didn't move focus (Left/Right at the row's end). --> <!-- pulse the scale nudge: confirms a press that didn't move focus (Left/Right at the row's end,
Up at the top tier). -->
<field id="nudge" type="boolean" alwaysNotify="true" /> <field id="nudge" type="boolean" alwaysNotify="true" />
</interface> </interface>
<children> <children>
@@ -337,11 +337,15 @@ function OnKeyEvent(key as string, press as boolean) as boolean
' BAR tier takes Up (back to the buttons) and lets the transport keys through. Rev/Fwd/Replay are not owned ' BAR tier takes Up (back to the buttons) and lets the transport keys through. Rev/Fwd/Replay are not owned
' by the buttons, so they fall through to the transport and move focus to the bar. ' by the buttons, so they fall through to the transport and move focus to the bar.
if press and CanFocusInteract() if press and CanFocusInteract()
' Up/Down move between the two tiers; a no-op at the ends is still consumed. ' Up/Down move between the two tiers; a no-op at the ends is still consumed — Up at the top tier
' (the buttons) pulses the focused button so the press visibly lands somewhere.
if key = RemoteKeys.Up or key = RemoteKeys.Down if key = RemoteKeys.Up or key = RemoteKeys.Down
newTarget = PlayerCoordinatorLogic.NextFocusTarget(m.focusTarget, key) newTarget = PlayerCoordinatorLogic.NextFocusTarget(m.focusTarget, key)
if newTarget <> m.focusTarget if newTarget <> m.focusTarget
SetFocusTarget(newTarget) SetFocusTarget(newTarget)
else if m.focusTarget = PlayerCoordinatorLogic.FocusTarget.Buttons
m.buttonRow.nudge = true
ArmAutoHide()
end if end if
return true return true
end if end if
@@ -833,6 +837,12 @@ function OnPosition(event as object) as void
ApplyTransport() ApplyTransport()
EnforceTransportFreeze() ' OnPosition only fires while playing, so it catches a transport auto-resumed with no state-change edge. EnforceTransportFreeze() ' OnPosition only fires while playing, so it catches a transport auto-resumed with no state-change edge.
' EnforceTransportFreeze can finish playback (FinishEof at the end of content under a transport), which
' synchronously closes the player and drops m.sponsorblock. A closed player must run no more of the tick.
if m.onCloseCalled = true
return
end if
' SponsorBlock auto-skip off the real position (the controller decides; we apply the seek / finish). ' SponsorBlock auto-skip off the real position (the controller decides; we apply the seek / finish).
sb = m.sponsorblock.OnPosition(posMs) sb = m.sponsorblock.OnPosition(posMs)
if sb <> invalid if sb <> invalid
@@ -933,6 +943,8 @@ function OnFullScreenChange() as void
LogDebug("fullscreen ->", fullscreen) LogDebug("fullscreen ->", fullscreen)
' the SponsorBlock notification rides with the player: hidden while minimized, shown when full. ' the SponsorBlock notification rides with the player: hidden while minimized, shown when full.
m.sponsorblock.SetVisible(fullscreen) m.sponsorblock.SetVisible(fullscreen)
' after a PiP restore the OS leaves captions blank while enableUI=false (resizing alone doesn't); suppress on minimize, release on restore to re-engage them.
m.top.suppressCaptions = not fullscreen
' minimized: no player UI at all. Reset any active transport (the bif/glyph clear; the underlying play/pause ' minimized: no player UI at all. Reset any active transport (the bif/glyph clear; the underlying play/pause
' stays as-is) and hide chrome/spinner/pause now. Fires for the minimize button, external minimize, and a ' stays as-is) and hide chrome/spinner/pause now. Fires for the minimize button, external minimize, and a
' video that starts minimized. ' video that starts minimized.
@@ -1102,19 +1114,20 @@ function OnVideoContentJobDone(event as object) as void
' live floor: how far back the DVR window reaches (0 = unknown -> the brain keeps the [0, edge] clamp). ' live floor: how far back the DVR window reaches (0 = unknown -> the brain keeps the [0, edge] clamp).
' The generated DASH anchors t=0 to the window start, so floor = edge - window as the session outlives it. ' The generated DASH anchors t=0 to the window start, so floor = edge - window as the session outlives it.
' The same window decides rewindability: a buffer-sized window means no live trickplay at all. ' The same window decides rewindability: a buffer-sized window means no live trickplay at all.
m.transport.SetLiveDvrWindow(ValidInt(metadata.liveDvrWindowSec) * 1000) ' Use the seekable depth (window - cushion) to match the manifest's timeShiftBufferDepth.
m.transport.SetLiveDvrWindow(ValidInt(metadata.liveSeekableWindowSec) * 1000)
m.trickPlayBar.isLive = isLive m.trickPlayBar.isLive = isLive
m.trickPlayBar.canRewind = m.transport.CanRewindLive() m.trickPlayBar.canRewind = m.transport.CanRewindLive()
m.bifDisplay.tileSet = invalid m.bifDisplay.tileSet = invalid
' anchor the live edge clock at the manifest's availabilityStartTime and start the 1s heartbeat: the brain ' anchor the live edge clock at the cushioned availabilityStartTime and start the 1s heartbeat: the brain
' gets a continuous edge (OnLiveEdge) that keeps advancing through pauses, so the time-behind offset is ' gets a continuous edge (OnLiveEdge) that keeps advancing through pauses, so the time-behind offset is
' always current — including the moment the chrome reveals. ' always current — including the moment the chrome reveals.
m.liveAstSeconds = -1 m.liveAstSeconds = -1
m.liveFallbackEdgeMs = -1 m.liveFallbackEdgeMs = -1
m.liveFallbackAtSeconds = 0 m.liveFallbackAtSeconds = 0
if isLive if isLive
ast = ValidString(metadata.liveAvailabilityStartUtc) ast = ValidString(metadata.liveCushionedAvailabilityStartUtc)
if ast <> "" if ast <> ""
astDate = CreateObject("roDateTime") astDate = CreateObject("roDateTime")
astDate.FromISO8601String(ast) astDate.FromISO8601String(ast)
@@ -11,7 +11,7 @@ end function
' getHttpAgent — Initialize does `m.top.getHttpAgent().AddHeader(...)`; a Group has no such method. No-op stub. ' getHttpAgent — Initialize does `m.top.getHttpAgent().AddHeader(...)`; a Group has no such method. No-op stub.
function getHttpAgent() as object function getHttpAgent() as object
return { return {
AddHeader: function(name as string, value as string) AddHeader: function(_name as string, _value as string)
end function end function
} }
end function end function
@@ -37,6 +37,13 @@ function TestSetup() as void
Initialize() ' the real coordinator init body (m.transport, findNode children, timer observers, getHttpAgent) Initialize() ' the real coordinator init body (m.transport, findNode children, timer observers, getHttpAgent)
' count ButtonRow nudge pulses (the field is a sticky alwaysNotify boolean, so the count — not the value —
' is what tells the spec whether a given press pulsed). Scoped + unobserve-first: the suite node is shared
' across tests, so a plain ObserveField here would stack one counter observer per TestSetup call.
m.top.nudgeCount = 0
m.buttonRow.unobserveFieldScoped("nudge")
m.buttonRow.observeFieldScoped("nudge", FuncName(OnTestNudge))
container = createObject("roSGNode", "Node") container = createObject("roSGNode", "Node")
container.addField("fullscreen", "boolean", false) container.addField("fullscreen", "boolean", false)
container.fullscreen = true container.fullscreen = true
@@ -72,6 +79,10 @@ function TestSetup() as void
OnNodeReady() OnNodeReady()
end function end function
function OnTestNudge() as void
m.top.nudgeCount += 1
end function
' TestKey — drive a remote key through the REAL OnKeyEvent (scrub/scan/commit/etc). ' TestKey — drive a remote key through the REAL OnKeyEvent (scrub/scan/commit/etc).
function TestKey(key as string, down as boolean) as boolean function TestKey(key as string, down as boolean) as boolean
return OnKeyEvent(key, down) return OnKeyEvent(key, down)
@@ -164,14 +175,30 @@ function TestSnapshot() as object
return { return {
transportMode: m.transport.transportMode transportMode: m.transport.transportMode
seekSettling: m.transport.seekSettling seekSettling: m.transport.seekSettling
onCloseCalled: m.onCloseCalled = true
control: m.top.control control: m.top.control
autoplay: m.top.autoplayAfterSeek autoplay: m.top.autoplayAfterSeek
bifVisible: m.bifDisplay.visible bifVisible: m.bifDisplay.visible
chromeShown: (m.chromeMode = ChromeMode.Shown or m.chromeMode = ChromeMode.FadingIn) chromeShown: (m.chromeMode = ChromeMode.Shown or m.chromeMode = ChromeMode.FadingIn)
suppressCaptions: m.top.suppressCaptions
focusTarget: m.focusTarget focusTarget: m.focusTarget
focusedButton: m.focusedButton focusedButton: m.focusedButton
nudgeCount: m.top.nudgeCount
forceLiveBadge: m.trickPlayBar.forceLiveBadge forceLiveBadge: m.trickPlayBar.forceLiveBadge
liveBadgeShown: m.trickPlayBar.findNode("liveLabel").visible liveBadgeShown: m.trickPlayBar.findNode("liveLabel").visible
barRemainingText: m.trickPlayBar.findNode("remainingLabel").text barRemainingText: m.trickPlayBar.findNode("remainingLabel").text
} }
end function end function
' TestWireQueueClose — make the stub videoQueue close the player when ClosePlayer writes closePlayer, mirroring
' the real VideoQueue.OnClosePlayer (which sets player.close = true). Opt-in: only the finish-during-tick
' re-entrancy spec needs the full synchronous teardown chain wired up.
function TestWireQueueClose() as void
m.videoQueue.observeFieldScoped("closePlayer", FuncName(OnTestQueueClose))
end function
function OnTestQueueClose() as void
if m.videoQueue.closePlayer
m.top.close = true
end if
end function
@@ -17,6 +17,7 @@
<field id="thumbnailTiles" type="assocarray" /> <field id="thumbnailTiles" type="assocarray" />
<field id="playbackSpeed" type="float" value="1.0" /> <field id="playbackSpeed" type="float" value="1.0" />
<field id="enableUI" type="boolean" value="true" /> <field id="enableUI" type="boolean" value="true" />
<field id="suppressCaptions" type="boolean" />
<field id="asyncStopSemantics" type="boolean" /> <field id="asyncStopSemantics" type="boolean" />
<field id="notificationInterval" type="float" /> <field id="notificationInterval" type="float" />
<field id="width" type="float" /> <field id="width" type="float" />
@@ -40,12 +41,15 @@
<field id="minRect" type="rect2D" value="[834,460,426,240]" /> <field id="minRect" type="rect2D" value="[834,460,426,240]" />
<field id="maxRect" type="rect2D" value="[0,0,1280,720]" /> <field id="maxRect" type="rect2D" value="[0,0,1280,720]" />
<field id="close" type="boolean" alwaysNotify="true" /> <field id="close" type="boolean" alwaysNotify="true" />
<!-- test-only probe: how many times the coordinator pulsed ButtonRow.nudge (TestSetup observes it). -->
<field id="nudgeCount" type="integer" />
<!-- the Video-only method Initialize calls, plus the spec's drivers (callFunc reaches only interface funcs). --> <!-- the Video-only method Initialize calls, plus the spec's drivers (callFunc reaches only interface funcs). -->
<function name="getHttpAgent" /> <function name="getHttpAgent" />
<function name="TestSetup" /> <function name="TestSetup" />
<function name="TestKey" /> <function name="TestKey" />
<function name="TestSetState" /> <function name="TestSetState" />
<function name="TestSnapshot" /> <function name="TestSnapshot" />
<function name="TestWireQueueClose" />
<function name="TestSetControl" /> <function name="TestSetControl" />
<function name="TestSetLive" /> <function name="TestSetLive" />
<function name="TestFireLiveBadgeHold" /> <function name="TestFireLiveBadgeHold" />
@@ -2,6 +2,7 @@
' inert and spec-driven) through scripted device-state sequences the real Roku Video won't produce on command. ' inert and spec-driven) through scripted device-state sequences the real Roku Video won't produce on command.
' This is the harness that would have caught the reported wedge: the existing INV-D* are blind to it (during the ' This is the harness that would have caught the reported wedge: the existing INV-D* are blind to it (during the
' wedge state="buffering", so "transport => state<>playing" was SATISFIED). The NEW property is P-seam. ' wedge state="buffering", so "transport => state<>playing" was SATISFIED). The NEW property is P-seam.
import "pkg:/components/VideoPlayerDev/PlayerCoordinatorLogic.bs"
import "pkg:/components/VideoPlayerDev/TransportController.bs" import "pkg:/components/VideoPlayerDev/TransportController.bs"
import "pkg:/components/VideoPlayerDev/VideoNode.bs" import "pkg:/components/VideoPlayerDev/VideoNode.bs"
import "pkg:/source/utils/RemoteKeys.bs" import "pkg:/source/utils/RemoteKeys.bs"
@@ -214,6 +215,56 @@ namespace Tests
m.assertEqual(m.Snap().focusedButton, 0, "a fresh reveal resets the highlight") m.assertEqual(m.Snap().focusedButton, 0, "a fresh reveal resets the highlight")
end function end function
' Up at the top tier (the buttons) has nowhere to go; the press must still visibly land — it pulses
' (nudges) the focused button instead of being swallowed.
@it("Up at the buttons tier nudges the focused button instead of moving focus")
function _()
m.top.callFunc("TestKey", RemoteKeys.Up, true) ' reveal -> buttons tier
before = m.Snap()
m.assertEqual(before.focusTarget, PlayerCoordinatorLogic.FocusTarget.Buttons)
m.assertEqual(before.nudgeCount, 0, "the reveal itself does not nudge")
m.top.callFunc("TestKey", RemoteKeys.Up, true) ' nowhere to go up
after = m.Snap()
m.assertEqual(after.nudgeCount, 1, "the no-op Up pulsed the focused button")
m.assertEqual(after.focusTarget, PlayerCoordinatorLogic.FocusTarget.Buttons, "focus stays on the buttons")
m.assertEqual(after.focusedButton, before.focusedButton, "the highlight is untouched")
end function
' A press that GOES somewhere must not nudge: Left/Right inside the row, Up/Down between the tiers.
@it("a press that moves focus does not nudge")
function _()
m.top.callFunc("TestKey", RemoteKeys.Up, true) ' reveal -> buttons tier, play/pause
m.top.callFunc("TestKey", RemoteKeys.Right, true) ' play/pause -> minimize
m.top.callFunc("TestKey", RemoteKeys.Down, true) ' buttons -> bar
m.top.callFunc("TestKey", RemoteKeys.Up, true) ' bar -> buttons
m.top.callFunc("TestKey", RemoteKeys.Left, true) ' minimize -> play/pause
m.assertEqual(m.Snap().nudgeCount, 0, "every press moved focus; none may pulse")
end function
' Left/Right clamped at the row's ends pulse the focused button (the original nudge path, at the seam).
@it("Left/Right clamped at the row ends nudge the focused button")
function _()
m.top.callFunc("TestKey", RemoteKeys.Up, true) ' reveal -> play/pause (leftmost)
m.top.callFunc("TestKey", RemoteKeys.Left, true) ' clamped at the left end
m.assertEqual(m.Snap().nudgeCount, 1)
m.top.callFunc("TestKey", RemoteKeys.Right, true) ' -> minimize (rightmost)
m.top.callFunc("TestKey", RemoteKeys.Right, true) ' clamped at the right end
snap = m.Snap()
m.assertEqual(snap.nudgeCount, 2)
m.assertEqual(snap.focusedButton, 1, "the clamp held the highlight at the end")
end function
' Down at the bar tier (the bottom) is also a no-op, but the bar is not a button: consumed, no nudge.
@it("Down at the bar tier is consumed without a nudge")
function _()
m.top.callFunc("TestKey", RemoteKeys.Up, true) ' reveal -> buttons tier
m.top.callFunc("TestKey", RemoteKeys.Down, true) ' buttons -> bar
m.top.callFunc("TestKey", RemoteKeys.Down, true) ' nowhere to go down
snap = m.Snap()
m.assertEqual(snap.focusTarget, PlayerCoordinatorLogic.FocusTarget.Bar, "focus stays on the bar")
m.assertEqual(snap.nudgeCount, 0)
end function
' A keep-playing seek issued while PAUSED must preserve the pause: the device auto-resumes on any seek ' A keep-playing seek issued while PAUSED must preserve the pause: the device auto-resumes on any seek
' (autoplayAfterSeek only governs rebuffer-resume per the Video docs), so the coordinator re-pauses on ' (autoplayAfterSeek only governs rebuffer-resume per the Video docs), so the coordinator re-pauses on
' the playing edge the auto-resume produces. ' the playing edge the auto-resume produces.
@@ -322,6 +373,19 @@ namespace Tests
end for end for
end function end function
' PiP captions (regression: subtitles stopped after shrink->grow). With enableUI=false the OS leaves
' captions blank after a PiP restore; minimize must suppress and restore must release — the
' suppress->release refresh re-engages OS caption rendering.
@it("PiP minimize suppresses captions; restore releases them")
function _()
container = m.top.container
m.assertFalse(m.Snap().suppressCaptions, "captions shown while fullscreen")
container.fullscreen = false
m.assertTrue(m.Snap().suppressCaptions, "captions suppressed while minimized")
container.fullscreen = true
m.assertFalse(m.Snap().suppressCaptions, "captions released on restore")
end function
' The PiP-toggle-after-close crash (captured on device): OnClose drops m.sponsorblock, so a leaked ' The PiP-toggle-after-close crash (captured on device): OnClose drops m.sponsorblock, so a leaked
' container observer makes the next fullscreen flip crash OnFullScreenChange (&hf3 on SetVisible). The ' container observer makes the next fullscreen flip crash OnFullScreenChange (&hf3 on SetVisible). The
' fix is unobserve-on-close + the onCloseCalled guard; a regression CRASHES this test. Kept LAST in the ' fix is unobserve-on-close + the onCloseCalled guard; a regression CRASHES this test. Kept LAST in the
@@ -353,6 +417,35 @@ namespace Tests
m.assertTrue(true, "no crash: the closed player ignored all post-close traffic") m.assertTrue(true, "no crash: the closed player ignored all post-close traffic")
end function end function
' Crash #1 (store: the dominant OnPosition crash, &hf3 ERR_RO3 "interface not a member"): a finish
' triggered from WITHIN a position tick re-enters teardown synchronously — EnforceTransportFreeze ->
' FinishEof -> OnPlaybackFinished -> ClosePlayer -> the queue sets player.close -> OnClose drops
' m.sponsorblock — then OnPosition continues to `m.sponsorblock.OnPosition()` and derefs the dropped
' controller. (`m.sponsorblock` is a field, so the invalid deref is &hf3, not &hec.) The OLD code crashes
' here; the onCloseCalled re-check after EnforceTransportFreeze bails. Kept LAST: OnClose detaches the node.
@it("a finish during a position tick must not deref the dropped sponsorblock (the OnPosition ERR_RO3 crash)")
function _()
m.top.callFunc("TestWireQueueClose") ' the stub queue now closes the player on closePlayer, as the real one does
m.top.duration = 100
m.top.position = 90
' scrub the cursor to the end (atEof) while the actual position is NOT yet at the end.
for i = 0 to 8
m.top.callFunc("TestKey", RemoteKeys.Right, true)
m.top.callFunc("TestKey", RemoteKeys.Right, false)
end for
m.assertEqual(m.Snap().transportMode, TransportController.Mode.Scrub)
' the device is PLAYING under the active transport (the INV-D1 anomaly EnforceTransportFreeze guards).
' Position is not yet at EOF, so this is a normal re-freeze — NOT a finish.
m.top.callFunc("TestSetState", VideoState.Playing)
m.assertFalse(m.Snap().onCloseCalled, "not finished yet — the position is not at EOF")
' NOW a position tick lands at the end -> OnPosition -> EnforceTransportFreeze -> FinishEof ->
' OnPlaybackFinished -> ClosePlayer -> (re-entrant) OnClose drops m.sponsorblock -> OnPosition then
' derefs the dropped controller. The old code faults here (&hf3); the fix bails first.
m.top.position = 99
' reaching here means OnPosition survived the re-entrant teardown.
m.assertTrue(m.Snap().onCloseCalled, "the finish closed the player from within the position tick")
end function
end class end class
end namespace end namespace
@@ -48,6 +48,10 @@ function OnPlay() as void
end if end if
player = CreateVideoPlayer() player = CreateVideoPlayer()
if player = invalid
m.top.nowPlaying = invalid
return
end if
player@.PlayWithContent(videoNode) player@.PlayWithContent(videoNode)
m.top.player = player m.top.player = player
m.top.nowPlaying = videoNode m.top.nowPlaying = videoNode
@@ -364,6 +368,10 @@ function CreateVideoPlayer() as object
container = m.top.videoContainer container = m.top.videoContainer
videoPlayer = container.createChild(playerComponent) videoPlayer = container.createChild(playerComponent)
if videoPlayer = invalid
LogError("createChild returned invalid for", playerComponent, "- cannot start playback")
return invalid
end if
videoPlayer.id = "VideoPlayer" videoPlayer.id = "VideoPlayer"
videoPlayer.previousPlayer = m.previousPlayer videoPlayer.previousPlayer = m.previousPlayer
' without this, the queue pins every last-closed player for the app's lifetime. ' without this, the queue pins every last-closed player for the app's lifetime.
@@ -10,6 +10,22 @@ import "pkg:/source/utils/Types.bs"
' playback; when the player asks for them the Await is short/instant. Small on ' playback; when the player asks for them the Await is short/instant. Small on
' purpose to bound concurrent roUrlTransfers (x2 representations). ' purpose to bound concurrent roUrlTransfers (x2 representations).
const LIVE_PREFETCH_SEGMENTS = 2 const LIVE_PREFETCH_SEGMENTS = 2
' Immediate refetches (no sleep) for transient network errors (reset/5xx) before surfacing 503.
' 204/timeout/4xx surface at once: an in-handler sleep would stall the queued audio request ~600ms
' on the single thread (measured).
const LIVE_SEG_MAX_ATTEMPTS = 3
' Why a live-segment fetch failed. The string values double as the telemetry message
' and fingerprint (see ReportSegmentFailure), so they must stay stable - changing one
' forks its Bugsink issue and orphans the history.
enum LiveSegFailure
NoFormatUrl = "no live format url"
FormatsNotArray = "adaptiveFormats not an array"
FetchFailed = "fragment fetch failed"
EmptyFragment = "empty fragment file"
NoMoov = "no moov in fragment"
NoMoof = "no moof in fragment"
end enum
namespace Http namespace Http
@@ -50,7 +66,7 @@ namespace Http
m.cachedInitSeqnum = 0 ' live-edge fragment to source the init from m.cachedInitSeqnum = 0 ' live-edge fragment to source the init from
m.probeByteCount = m.INITIAL_PROBE_BYTE_COUNT ' current box-walk probe; only grows m.probeByteCount = m.INITIAL_PROBE_BYTE_COUNT ' current box-walk probe; only grows
m.reportedFailures = {} ' per-video telemetry dedupe (see ReportSegmentFailure) m.reportedFailures = {} ' per-video telemetry dedupe (see ReportSegmentFailure)
' Prefetch cache: "itag|nativeSq" -> in-flight StartSegmentFetch entry, ' Prefetch cache: "itag|sq" -> in-flight StartSegmentFetch entry,
' warmed ahead of the player so awaits hit already-downloading fragments. ' warmed ahead of the player so awaits hit already-downloading fragments.
m.prefetch = {} m.prefetch = {}
' Last itag served per media kind. When the player switches representation ' Last itag served per media kind. When the player switches representation
@@ -58,6 +74,13 @@ namespace Http
' so they don't leak until the next video change. ' so they don't leak until the next video change.
m.lastVideoItag = invalid m.lastVideoItag = invalid
m.lastAudioItag = invalid m.lastAudioItag = invalid
' itag -> transformed init bytes (ftyp+moov). moov is constant per
' representation, so fetch once and serve later init requests from memory.
' Cleared per video in RebuildLiveCache.
m.cachedInit = {}
' Highest native sq requested; sources the init from a current fragment (the
' load-time live edge ages out of the DVR window over a long session).
m.lastSeenSq = 0
end function end function
' Returns the cached metadata AA for video id `v`, digging the videoQueue ' Returns the cached metadata AA for video id `v`, digging the videoQueue
@@ -227,8 +250,8 @@ namespace Http
' '
' Endpoint (see DashManifest live SegmentTemplate); segments map 1:1 to native ' Endpoint (see DashManifest live SegmentTemplate); segments map 1:1 to native
' fragments, so the DASH segment number is the native sq: ' fragments, so the DASH segment number is the native sq:
' /api/dash/live-seg?v=<id>&itag=<itag>&sq=init -> ftyp+moov of the live-edge fragment ' /api/dash/live-seg?v=<id>&itag=<itag>&init=true -> ftyp+moov of the live-edge fragment
' /api/dash/live-seg?v=<id>&itag=<itag>&sq=<N> -> moof+mdat of fragment N ' /api/dash/live-seg?v=<id>&itag=<itag>&sq=<N> -> moof+mdat of fragment N
' '
' This is a hot path (called for every audio + video segment, continuously), ' This is a hot path (called for every audio + video segment, continuously),
' so it is written to minimize per-request work: the itag -> url/type lookups ' so it is written to minimize per-request work: the itag -> url/type lookups
@@ -243,10 +266,14 @@ namespace Http
v = request.query.v v = request.query.v
itag = request.query.itag itag = request.query.itag
sq = request.query.sq isInit = ValidString(request.query.init) = "true"
sq = -1
if not isInit
sq = ValidString(request.query.sq).ToInt()
end if
if StringUtils.IsNullOrEmpty(itag) or StringUtils.IsNullOrEmpty(sq) or StringUtils.IsNullOrEmpty(v) if StringUtils.IsNullOrEmpty(itag) or StringUtils.IsNullOrEmpty(v) or (not isInit and sq <= 0)
response.Default(400, "Missing v, itag or sq") response.Default(400, "Missing or invalid v, itag, or sq")
return true return true
end if end if
@@ -257,30 +284,37 @@ namespace Http
baseUrl = m.cachedUrls[itag] baseUrl = m.cachedUrls[itag]
if StringUtils.IsNullOrEmpty(baseUrl) if StringUtils.IsNullOrEmpty(baseUrl)
LogErrorNoTelemetry("[LIVE-SEG] no live format url for v:", v, "itag:", itag, "-> 404") LogErrorNoTelemetry("[LIVE-SEG] no live format url for v:", v, "itag:", itag, "-> 404")
m.ReportSegmentFailure("no live format url", { v: v, itag: itag, sq: sq }) m.ReportSegmentFailure(LiveSegFailure.NoFormatUrl, { v: v, itag: itag, sq: sq })
response.Default(404, "No live format url for itag " + itag) response.Default(404, "No live format url for itag " + itag)
return true return true
end if end if
if sq = "init" if isInit
' Init segment: ftyp+moov. We must NOT use fragment 0 - for a ' ftyp+moov, served from the per-itag cache after the first fetch.
' long-running live stream (e.g. a 24/7 channel up for weeks) sq=0 is output = m.cachedInit[itag]
' far outside the DVR window and googlevideo 404s it. Every live
' fragment is self-initializing with an identical moov (constant
' codec config), so we source the init from the live-edge fragment
' (cachedInitSeqnum), which is always within the DVR window.
output = m.AwaitTransformedSegment(m.StartSegmentFetch(baseUrl, m.cachedInitSeqnum, v, itag), true)
if output = invalid if output = invalid
' Root-cause telemetry already emitted by AwaitTransformedSegment. ' Source from a current fragment: sq=0 is outside the DVR window (404)
LogErrorNoTelemetry("[LIVE-SEG] INIT fetch failed v:", v, "itag:", itag, "-> 502") ' and the load-time edge ages out, so prefer lastSeenSq; fall back to
response.Default(502, "Failed to fetch live init segment") ' the load-time seqnum only before any media segment is served.
return true initSq = m.cachedInitSeqnum
if m.lastSeenSq > 0
initSq = m.lastSeenSq
end if
output = m.AwaitSegmentWithRetry(baseUrl, initSq, v, itag, true, invalid)
if output = invalid
LogErrorNoTelemetry("[LIVE-SEG] INIT fetch failed v:", v, "itag:", itag, "-> 503")
response.Default(503, "Live init segment not ready")
return true
end if
m.cachedInit[itag] = output
end if end if
else else
' Media DASH segment = one native YouTube fragment, reduced to moof+mdat ' Media DASH segment = one native YouTube fragment, reduced to moof+mdat
' so Roku reads the init segment only once. The manifest addresses the ' so Roku reads the init segment only once. The manifest addresses the
' proxy 1:1, so the DASH segment number is the native sq. ' proxy 1:1, so the DASH segment number is the native sq.
nativeSq = sq.ToInt() if sq > m.lastSeenSq
m.lastSeenSq = sq
end if
' Representation switch (ABR video / audio track): the previous itag of ' Representation switch (ABR video / audio track): the previous itag of
' this kind stops being requested, so evict its warmed fragments now - ' this kind stops being requested, so evict its warmed fragments now -
@@ -302,15 +336,16 @@ namespace Http
' (Send, no Await) BEFORE blocking here so their downloads overlap this ' (Send, no Await) BEFORE blocking here so their downloads overlap this
' fragment's await + playback; then drop entries now outside the window ' fragment's await + playback; then drop entries now outside the window
' (played past, or stranded by a seek) so the cache + temp files stay bounded. ' (played past, or stranded by a seek) so the cache + temp files stay bounded.
entry = m.GetOrStartFetch(baseUrl, nativeSq, v, itag) entry = m.GetOrStartFetch(baseUrl, sq, v, itag)
m.PrefetchAhead(baseUrl, v, itag, nativeSq, LIVE_PREFETCH_SEGMENTS) m.PrefetchAhead(baseUrl, v, itag, sq, LIVE_PREFETCH_SEGMENTS)
m.EvictPrefetchOutside(itag, nativeSq + 1, nativeSq + LIVE_PREFETCH_SEGMENTS) m.EvictPrefetchOutside(itag, sq + 1, sq + LIVE_PREFETCH_SEGMENTS)
output = m.AwaitTransformedSegment(entry, false) output = m.AwaitSegmentWithRetry(baseUrl, sq, v, itag, false, entry)
if output = invalid if output = invalid
' Root-cause telemetry already emitted by AwaitTransformedSegment. ' 503 makes Roku re-request the same sq and hold the bitrate (verified); the
LogErrorNoTelemetry("[LIVE-SEG] media fragment failed v:", v, "itag:", itag, "sq:", nativeSq, "-> 502") ' fragment will exist within ~one re-request.
response.Default(502, "Failed to fetch live media segment") LogErrorNoTelemetry("[LIVE-SEG] media fragment not ready v:", v, "itag:", itag, "sq:", sq, "-> 503")
response.Default(503, "Live media segment not ready")
return true return true
end if end if
end if end if
@@ -338,6 +373,9 @@ namespace Http
m.CleanupTempSegments() m.CleanupTempSegments()
' Re-arm the per-video telemetry dedupe (see ReportSegmentFailure). ' Re-arm the per-video telemetry dedupe (see ReportSegmentFailure).
m.reportedFailures = {} m.reportedFailures = {}
' Init bytes and the sq high-water mark belong to the previous video.
m.cachedInit = {}
m.lastSeenSq = 0
urls = {} urls = {}
types = {} types = {}
@@ -355,7 +393,7 @@ namespace Http
end for end for
else else
LogErrorNoTelemetry("[LIVE-SEG] RebuildLiveCache: adaptiveFormats not an array for v:", metadata.videoId) LogErrorNoTelemetry("[LIVE-SEG] RebuildLiveCache: adaptiveFormats not an array for v:", metadata.videoId)
m.ReportSegmentFailure("adaptiveFormats not an array", { v: ValidString(metadata.videoId) }) m.ReportSegmentFailure(LiveSegFailure.FormatsNotArray, { v: ValidString(metadata.videoId) })
end if end if
m.cachedUrls = urls m.cachedUrls = urls
@@ -475,22 +513,66 @@ namespace Http
DeleteFile(entry.tmpPath) DeleteFile(entry.tmpPath)
end function end function
' Await a fetch started by StartSegmentFetch and return just the bytes Roku ' Await `entry` (invalid -> fetch fresh), transform to the bytes Roku needs (wantInit ->
' needs: ' ftyp+moov, else moof+mdat), retrying transient failures up to LIVE_SEG_MAX_ATTEMPTS. Each
' wantInit = true -> ftyp+moov (init segment) ' retry refetches the same sq, which also un-poisons a prefetched 204. Telemetry fires once.
' wantInit = false -> moof+mdat (media segment) function AwaitSegmentWithRetry(baseUrl as string, sq as integer, v as string, itag as string, wantInit as boolean, entry as object) as dynamic
' Reads only the required byte range from the temp file and always deletes if entry = invalid
' it. Returns invalid on failure. entry = m.StartSegmentFetch(baseUrl, sq, v, itag)
function AwaitTransformedSegment(entry as object, wantInit as boolean) as dynamic end if
attempt = 1
while true
result = m.AttemptSegment(entry, wantInit)
if result.ok
return result.bytes
end if
' 204 = sq not produced yet. Return 503 and let Roku re-ask (same sq, then resyncs);
' a sleep+refetch here would stall the queued audio ~600ms on the single thread
' (measured). Evict the warmed siblings - fetched too early, they 204'd too.
if result.reason = LiveSegFailure.EmptyFragment
if not wantInit
m.EvictPrefetchItag(itag)
end if
m.ReportSegmentFailure(result.reason, { v: v, itag: itag, sq: sq, head: m.liveHeadSeqnum, segUrl: entry.segUrl, response: result.response })
return invalid
end if
if (not result.retryable) or attempt >= LIVE_SEG_MAX_ATTEMPTS
m.ReportSegmentFailure(result.reason, { v: v, itag: itag, sq: sq, head: m.liveHeadSeqnum, segUrl: entry.segUrl, response: result.response })
return invalid
end if
' Network/5xx: transient; discard and refetch immediately (no sleep).
LogWarnNoTelemetry("[LIVE-SEG] retry sq", sq, "itag", itag, "(", result.reason, ") attempt", attempt + 1, "of", LIVE_SEG_MAX_ATTEMPTS)
attempt += 1
entry = m.StartSegmentFetch(baseUrl, sq, v, itag)
end while
return invalid
end function
' One fetch+transform attempt. Reads only the needed byte range from the temp
' file and always deletes it. Returns:
' { ok: true, bytes } - the transformed segment bytes
' { ok: false, retryable, reason, response } - failed; `retryable` marks fast transient
' NETWORK errors (reset/-10001, 5xx) worth an immediate refetch. 204/empty is handled
' specially by the caller (immediate 503); timeout/4xx/malformed are not retried.
function AttemptSegment(entry as object, wantInit as boolean) as object
tmpPath = entry.tmpPath tmpPath = entry.tmpPath
sq = entry.sq sq = entry.sq
response = entry.req.Await() response = entry.req.Await()
m.liveHeadSeqnum = m.ReadHeadSeqnum(response)
if not response.IsSuccess() if not response.IsSuccess()
LogErrorNoTelemetry("[LIVE-SEG] fetch sq", sq, "failed:", response.StatusCode()) status = response.StatusCode()
m.ReportSegmentFailure("fragment fetch failed", { v: entry.v, itag: entry.itag, sq: sq, segUrl: entry.segUrl, response: response }) LogErrorNoTelemetry("[LIVE-SEG] fetch sq", sq, "failed:", status)
DeleteFile(tmpPath) DeleteFile(tmpPath)
return invalid ' status<0 = active error event (reset/-10001), 5xx = server error: both
' transient -> retried. status 0 = timeout (slow/hung) -> not retried.
return { ok: false, retryable: status < 0 or status >= 500, reason: LiveSegFailure.FetchFailed, response: response }
end if end if
stat = m.fs.Stat(tmpPath) stat = m.fs.Stat(tmpPath)
@@ -499,10 +581,10 @@ namespace Http
fileLen = ValidInt(stat.size) fileLen = ValidInt(stat.size)
end if end if
if fileLen <= 0 if fileLen <= 0
LogErrorNoTelemetry("[LIVE-SEG] fetch sq", sq, "empty file") LogErrorNoTelemetry("[LIVE-SEG] fetch sq", sq, "empty file (status", response.StatusCode(), ")")
m.ReportSegmentFailure("empty fragment file", { v: entry.v, itag: entry.itag, sq: sq, segUrl: entry.segUrl, response: response })
DeleteFile(tmpPath) DeleteFile(tmpPath)
return invalid ' 204/empty handled specially by the caller (immediate 503, no in-handler retry).
return { ok: false, retryable: false, reason: LiveSegFailure.EmptyFragment, response: response }
end if end if
boxes = m.LocateBoxes(tmpPath, fileLen) boxes = m.LocateBoxes(tmpPath, fileLen)
@@ -511,23 +593,32 @@ namespace Http
if wantInit if wantInit
if boxes.moovEnd <= 0 or boxes.moovEnd > fileLen if boxes.moovEnd <= 0 or boxes.moovEnd > fileLen
LogErrorNoTelemetry("[LIVE-SEG] no moov in fragment sq", sq, "(moovEnd:", boxes.moovEnd, ")") LogErrorNoTelemetry("[LIVE-SEG] no moov in fragment sq", sq, "(moovEnd:", boxes.moovEnd, ")")
m.ReportSegmentFailure("no moov in fragment", { v: entry.v, itag: entry.itag, sq: sq, segUrl: entry.segUrl, response: response })
DeleteFile(tmpPath) DeleteFile(tmpPath)
return invalid return { ok: false, retryable: false, reason: LiveSegFailure.NoMoov, response: response }
end if end if
out.ReadFile(tmpPath, 0, boxes.moovEnd) out.ReadFile(tmpPath, 0, boxes.moovEnd)
else else
if boxes.moofStart <= 0 or boxes.moofStart >= fileLen if boxes.moofStart <= 0 or boxes.moofStart >= fileLen
LogErrorNoTelemetry("[LIVE-SEG] no moof in fragment sq", sq, "(moofStart:", boxes.moofStart, ")") LogErrorNoTelemetry("[LIVE-SEG] no moof in fragment sq", sq, "(moofStart:", boxes.moofStart, ")")
m.ReportSegmentFailure("no moof in fragment", { v: entry.v, itag: entry.itag, sq: sq, segUrl: entry.segUrl, response: response })
DeleteFile(tmpPath) DeleteFile(tmpPath)
return invalid return { ok: false, retryable: false, reason: LiveSegFailure.NoMoof, response: response }
end if end if
out.ReadFile(tmpPath, boxes.moofStart, fileLen - boxes.moofStart) out.ReadFile(tmpPath, boxes.moofStart, fileLen - boxes.moofStart)
end if end if
DeleteFile(tmpPath) DeleteFile(tmpPath)
return out return { ok: true, bytes: out }
end function
' Live head sequence number from a fragment response's X-Head-Seqnum header (-1 if
' absent). Stashed (m.liveHeadSeqnum) so ReportSegmentFailure records how far ahead of
' the real edge a failed sq was (delta = sq - head) - the field signal for edge overshoot.
function ReadHeadSeqnum(response as object) as integer
headers = response.Headers()
if IsAssociativeArray(headers) and headers.DoesExist("X-Head-Seqnum")
return ValidString(headers["X-Head-Seqnum"]).ToInt()
end if
return -1
end function end function
' Read the leading boxes of a fragment temp file and return moov/moof offsets. ' Read the leading boxes of a fragment temp file and return moov/moof offsets.
@@ -584,7 +675,7 @@ namespace Http
' capture a transient blip and a later persistent failure separately, without ' capture a transient blip and a later persistent failure separately, without
' flooding identical failures every few seconds (Sentry quota). Re-armed per ' flooding identical failures every few seconds (Sentry quota). Re-armed per
' video in RebuildLiveCache. ' video in RebuildLiveCache.
function ReportSegmentFailure(reason as string, info as object) as void function ReportSegmentFailure(reason as LiveSegFailure, info as object) as void
statusText = "n/a" statusText = "n/a"
errorMessage = "" errorMessage = ""
response = info.response response = info.response
@@ -599,11 +690,21 @@ namespace Http
end if end if
m.reportedFailures[dedupeKey] = true m.reportedFailures[dedupeKey] = true
' Edge overshoot: how far past the live head (X-Head-Seqnum at the failing fetch, via
' info.head) the failed sq was. delta > 0 = a not-yet-produced fragment (the 503 cause).
head = ValidInt(info.head)
sqNum = ValidInt(info.sq)
deltaText = "n/a"
if head > 0 and sqNum > 0
deltaText = (sqNum - head).ToStr()
end if
details = [ details = [
"reason: " + reason "reason: " + reason
"videoId: " + ValidString(info.v) "videoId: " + ValidString(info.v)
"itag: " + ValidString(info.itag) "itag: " + ValidString(info.itag)
"sq: " + ToString(info.sq) "sq: " + ToString(info.sq)
"head: " + head.ToStr()
"delta: " + deltaText
"status: " + statusText "status: " + statusText
"error: " + errorMessage "error: " + errorMessage
"url: " + ValidString(info.segUrl) "url: " + ValidString(info.segUrl)
+3
View File
@@ -166,6 +166,9 @@
preview: { preview: {
option: "manual_skip", option: "manual_skip",
}, },
hook: {
option: "manual_skip",
},
filler: { filler: {
option: "manual_skip", option: "manual_skip",
}, },
@@ -8,6 +8,7 @@
"intro", "intro",
"outro", "outro",
"preview", "preview",
"hook",
"filler", "filler",
"music_offtopic", "music_offtopic",
], ],
@@ -49,11 +50,17 @@
color: "#0202EDB3", color: "#0202EDB3",
}, },
preview: { preview: {
title: "Preview/Recap/Hook", title: "Preview/Recap",
short_title: "Preview/Recap", short_title: "Preview/Recap",
options: ["auto_skip", "manual_skip", "show_in_seekbar", "disable"], options: ["auto_skip", "manual_skip", "show_in_seekbar", "disable"],
color: "#008FD6B3", color: "#008FD6B3",
}, },
hook: {
title: "Hook/Greetings",
short_title: "Hook/Greetings",
options: ["auto_skip", "manual_skip", "show_in_seekbar", "disable"],
color: "#395699B3",
},
filler: { filler: {
title: "Filler Tangent/Jokes", title: "Filler Tangent/Jokes",
short_title: "Filler", short_title: "Filler",
+4 -4
View File
@@ -720,14 +720,14 @@
<source>Endcards/Credits</source> <source>Endcards/Credits</source>
<translation>Endcard/Abspann</translation> <translation>Endcard/Abspann</translation>
</message> </message>
<message>
<source>Preview/Recap/Hook</source>
<translation>Vorschau/Rückschau/Hook</translation>
</message>
<message> <message>
<source>Preview/Recap</source> <source>Preview/Recap</source>
<translation>Vorschau/Rückschau</translation> <translation>Vorschau/Rückschau</translation>
</message> </message>
<message>
<source>Hook/Greetings</source>
<translation>Hook/Begrüßungen</translation>
</message>
<message> <message>
<source>Filler</source> <source>Filler</source>
<translation>Füllwörter/ Zeitverschwendung</translation> <translation>Füllwörter/ Zeitverschwendung</translation>
+4 -4
View File
@@ -1060,14 +1060,14 @@
<source>Endcards/Credits</source> <source>Endcards/Credits</source>
<translation>Endcards/Credits</translation> <translation>Endcards/Credits</translation>
</message> </message>
<message>
<source>Preview/Recap/Hook</source>
<translation>Preview/Recap/Hook</translation>
</message>
<message> <message>
<source>Preview/Recap</source> <source>Preview/Recap</source>
<translation>Preview/Recap</translation> <translation>Preview/Recap</translation>
</message> </message>
<message>
<source>Hook/Greetings</source>
<translation>Hook/Greetings</translation>
</message>
<message> <message>
<source>Filler Tangent/Jokes</source> <source>Filler Tangent/Jokes</source>
<translation>Filler Tangent/Jokes</translation> <translation>Filler Tangent/Jokes</translation>
+4 -4
View File
@@ -624,6 +624,10 @@
<source>Preview/Recap</source> <source>Preview/Recap</source>
<translation>Vista previa/Resumen</translation> <translation>Vista previa/Resumen</translation>
</message> </message>
<message>
<source>Hook/Greetings</source>
<translation>Gancho/Saludos</translation>
</message>
<message> <message>
<source>Added to queue</source> <source>Added to queue</source>
<translation>Añadir a la cola</translation> <translation>Añadir a la cola</translation>
@@ -1128,10 +1132,6 @@
<source>Endcards/Credits</source> <source>Endcards/Credits</source>
<translation>Tarjeta final/Créditos</translation> <translation>Tarjeta final/Créditos</translation>
</message> </message>
<message>
<source>Preview/Recap/Hook</source>
<translation>Vista previa/Resumen/Gancho</translation>
</message>
<message> <message>
<source>Press and hold Options (*) to open the queue</source> <source>Press and hold Options (*) to open the queue</source>
<translation>Mantén pulsado Opciones (*) para abrir la cola</translation> <translation>Mantén pulsado Opciones (*) para abrir la cola</translation>
+2 -2
View File
@@ -1201,8 +1201,8 @@
<translation>Avance/Resumen</translation> <translation>Avance/Resumen</translation>
</message> </message>
<message> <message>
<source>Preview/Recap/Hook</source> <source>Hook/Greetings</source>
<translation>Avance/Resumen/Gancho</translation> <translation>Gancho/Saludos</translation>
</message> </message>
<message> <message>
<source>Sponsor</source> <source>Sponsor</source>
+4 -4
View File
@@ -912,14 +912,14 @@
<source>Endcards/Credits</source> <source>Endcards/Credits</source>
<translation>Écrans de fin/Crédits</translation> <translation>Écrans de fin/Crédits</translation>
</message> </message>
<message>
<source>Preview/Recap/Hook</source>
<translation>Aperçu/Récapitulatif/Accroche</translation>
</message>
<message> <message>
<source>Preview/Recap</source> <source>Preview/Recap</source>
<translation>Aperçu/Récapitulatif</translation> <translation>Aperçu/Récapitulatif</translation>
</message> </message>
<message>
<source>Hook/Greetings</source>
<translation>Accroche/Salutations</translation>
</message>
<message> <message>
<source>Filler Tangent/Jokes</source> <source>Filler Tangent/Jokes</source>
<translation>Digressions/Blagues</translation> <translation>Digressions/Blagues</translation>
+4 -4
View File
@@ -788,10 +788,6 @@
<source>Endcards/Credits</source> <source>Endcards/Credits</source>
<translation>Cards finais/Créditos</translation> <translation>Cards finais/Créditos</translation>
</message> </message>
<message>
<source>Preview/Recap/Hook</source>
<translation>Pré-visualização/Recapitulação/Gancho</translation>
</message>
<message> <message>
<source>Intermission/Intro Animation</source> <source>Intermission/Intro Animation</source>
<translation>Intermissão/Animação de introdução</translation> <translation>Intermissão/Animação de introdução</translation>
@@ -800,6 +796,10 @@
<source>Preview/Recap</source> <source>Preview/Recap</source>
<translation>Pré-visualização/Recapitulação</translation> <translation>Pré-visualização/Recapitulação</translation>
</message> </message>
<message>
<source>Hook/Greetings</source>
<translation>Gancho/Saudações</translation>
</message>
<message> <message>
<source>Filler Tangent/Jokes</source> <source>Filler Tangent/Jokes</source>
<translation>Preenchimento Tangente/Piadas</translation> <translation>Preenchimento Tangente/Piadas</translation>
+2 -2
View File
@@ -2,8 +2,8 @@ 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=46 minor_version=47
build_version=00000 build_version=00003
ui_resolutions=hd ui_resolutions=hd
uri_resolution_autosub=$$RES$$,480p,720p,1080p uri_resolution_autosub=$$RES$$,480p,720p,1080p
@@ -1,3 +1,4 @@
import "pkg:/source/utils/CodecCapabilities.bs"
import "pkg:/source/utils/StringUtils.bs" import "pkg:/source/utils/StringUtils.bs"
class ApplicationInfo class ApplicationInfo
@@ -80,6 +81,7 @@ class ApplicationInfo
user_country_code: m.roDeviceInfo.GetUserCountryCode() user_country_code: m.roDeviceInfo.GetUserCountryCode()
friendly_name: m.roDeviceInfo.GetFriendlyName() friendly_name: m.roDeviceInfo.GetFriendlyName()
current_locale: m.roDeviceInfo.GetCurrentLocale() current_locale: m.roDeviceInfo.GetCurrentLocale()
can_decode_av1: CodecCapabilities.CanDecodeAv1()
} }
end if end if
return m.deviceInfo return m.deviceInfo
@@ -0,0 +1,10 @@
namespace CodecCapabilities
' YouTube serves streams above 1080p only as AV1 (mp4) and VP9 (webm), and the
' player only plays fragmented MP4 in DASH - so AV1 decoding is what decides
' whether the device can play 4K.
function CanDecodeAv1() as boolean
devInfo = CreateObject("roDeviceInfo")
canDecode = devInfo.CanDecodeVideo({ "codec": "av1" })
return canDecode.result = true
end function
end namespace
+2 -2
View File
@@ -353,8 +353,8 @@ namespace Locale
IntroTitle = "Intermission/Intro Animation" IntroTitle = "Intermission/Intro Animation"
IntroShortTitle = "Intermission" IntroShortTitle = "Intermission"
OutroTitle = "Endcards/Credits" OutroTitle = "Endcards/Credits"
PreviewTitle = "Preview/Recap/Hook" PreviewTitle = "Preview/Recap"
PreviewShortTitle = "Preview/Recap" HookTitle = "Hook/Greetings"
FillerTitle = "Filler Tangent/Jokes" FillerTitle = "Filler Tangent/Jokes"
FillerShortTitle = "Filler" FillerShortTitle = "Filler"
ChapterTitle = "Chapter" ChapterTitle = "Chapter"
+91 -91
View File
@@ -1,30 +1,30 @@
{ {
"name": "playlet-web", "name": "playlet-web",
"version": "0.46.0", "version": "0.47.3",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet-web", "name": "playlet-web",
"version": "0.46.0", "version": "0.47.3",
"devDependencies": { "devDependencies": {
"@sveltejs/vite-plugin-svelte": "^7.1.2", "@sveltejs/vite-plugin-svelte": "^7.1.2",
"@tailwindcss/postcss": "^4.3.0", "@tailwindcss/postcss": "^4.3.1",
"@tailwindcss/typography": "^0.5.19", "@tailwindcss/typography": "^0.5.20",
"@tsconfig/svelte": "^5.0.8", "@tsconfig/svelte": "^5.0.8",
"@vitejs/plugin-legacy": "^8.0.2", "@vitejs/plugin-legacy": "^8.0.2",
"autoprefixer": "^10.5.0", "autoprefixer": "^10.5.0",
"bgutils-js": "^3.2.0", "bgutils-js": "^3.2.0",
"daisyui": "^5.5.20", "daisyui": "^5.5.23",
"dotenv": "^17.4.2", "dotenv": "^17.4.2",
"ip": "^2.0.1", "ip": "^2.0.1",
"jszip": "^3.10.1", "jszip": "^3.10.1",
"postcss": "^8.5.15", "postcss": "^8.5.15",
"rollup-plugin-visualizer": "^7.0.1", "rollup-plugin-visualizer": "^7.0.1",
"svelte": "^5.56.2", "svelte": "^5.56.3",
"svelte-check": "^4.6.0", "svelte-check": "^4.6.0",
"svelte-preprocess": "6.0.3", "svelte-preprocess": "6.0.3",
"tailwindcss": "^4.3.0", "tailwindcss": "^4.3.1",
"terser": "^5.48.0", "terser": "^5.48.0",
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.9.3", "typescript": "^5.9.3",
@@ -2014,49 +2014,49 @@
} }
}, },
"node_modules/@tailwindcss/node": { "node_modules/@tailwindcss/node": {
"version": "4.3.0", "version": "4.3.1",
"resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.3.0.tgz", "resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.3.1.tgz",
"integrity": "sha512-aFb4gUhFOgdh9AXo4IzBEOzBkkAxm9VigwDJnMIYv3lcfXCJVesNfbEaBl4BNgVRyid92AmdviqwBUBRKSeY3g==", "integrity": "sha512-6NDaqRoAMSXD1mr/RXu0HBvNE9a2n5tHPsxu9XHLws8o4Twes5rBM2205SUUiJ9goAtadrN6xTGX0UDEwp/N4A==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@jridgewell/remapping": "^2.3.5", "@jridgewell/remapping": "^2.3.5",
"enhanced-resolve": "^5.21.0", "enhanced-resolve": "5.21.6",
"jiti": "^2.6.1", "jiti": "^2.7.0",
"lightningcss": "1.32.0", "lightningcss": "1.32.0",
"magic-string": "^0.30.21", "magic-string": "^0.30.21",
"source-map-js": "^1.2.1", "source-map-js": "^1.2.1",
"tailwindcss": "4.3.0" "tailwindcss": "4.3.1"
} }
}, },
"node_modules/@tailwindcss/oxide": { "node_modules/@tailwindcss/oxide": {
"version": "4.3.0", "version": "4.3.1",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide/-/oxide-4.3.0.tgz", "resolved": "https://registry.npmjs.org/@tailwindcss/oxide/-/oxide-4.3.1.tgz",
"integrity": "sha512-F7HZGBeN9I0/AuuJS5PwcD8xayx5ri5GhjYUDBEVYUkexyA/giwbDNjRVrxSezE3T250OU2K/wp/ltWx3UOefg==", "integrity": "sha512-yVPyo8RNkabVr3O2EhHEE0Rewu7YKzc1DhIqfL46LKveFrmu9XbDazNOJY7/GRuvw1h6u3utWnR29H/p5JPlgA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">= 20" "node": ">= 20"
}, },
"optionalDependencies": { "optionalDependencies": {
"@tailwindcss/oxide-android-arm64": "4.3.0", "@tailwindcss/oxide-android-arm64": "4.3.1",
"@tailwindcss/oxide-darwin-arm64": "4.3.0", "@tailwindcss/oxide-darwin-arm64": "4.3.1",
"@tailwindcss/oxide-darwin-x64": "4.3.0", "@tailwindcss/oxide-darwin-x64": "4.3.1",
"@tailwindcss/oxide-freebsd-x64": "4.3.0", "@tailwindcss/oxide-freebsd-x64": "4.3.1",
"@tailwindcss/oxide-linux-arm-gnueabihf": "4.3.0", "@tailwindcss/oxide-linux-arm-gnueabihf": "4.3.1",
"@tailwindcss/oxide-linux-arm64-gnu": "4.3.0", "@tailwindcss/oxide-linux-arm64-gnu": "4.3.1",
"@tailwindcss/oxide-linux-arm64-musl": "4.3.0", "@tailwindcss/oxide-linux-arm64-musl": "4.3.1",
"@tailwindcss/oxide-linux-x64-gnu": "4.3.0", "@tailwindcss/oxide-linux-x64-gnu": "4.3.1",
"@tailwindcss/oxide-linux-x64-musl": "4.3.0", "@tailwindcss/oxide-linux-x64-musl": "4.3.1",
"@tailwindcss/oxide-wasm32-wasi": "4.3.0", "@tailwindcss/oxide-wasm32-wasi": "4.3.1",
"@tailwindcss/oxide-win32-arm64-msvc": "4.3.0", "@tailwindcss/oxide-win32-arm64-msvc": "4.3.1",
"@tailwindcss/oxide-win32-x64-msvc": "4.3.0" "@tailwindcss/oxide-win32-x64-msvc": "4.3.1"
} }
}, },
"node_modules/@tailwindcss/oxide-android-arm64": { "node_modules/@tailwindcss/oxide-android-arm64": {
"version": "4.3.0", "version": "4.3.1",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-android-arm64/-/oxide-android-arm64-4.3.0.tgz", "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-android-arm64/-/oxide-android-arm64-4.3.1.tgz",
"integrity": "sha512-TJPiq67tKlLuObP6RkwvVGDoxCMBVtDgKkLfa/uyj7/FyxvQwHS+UOnVrXXgbEsfUaMgiVvC4KbJnRr26ho4Ng==", "integrity": "sha512-SVlyf61g374l5cHyg8x9kf5xmLcOaxvOTsbsqDnSsDJaKOEFZ7GCvi84VAVGpxojYOs1+3K6M0UjXfqPU8vmOQ==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -2071,9 +2071,9 @@
} }
}, },
"node_modules/@tailwindcss/oxide-darwin-arm64": { "node_modules/@tailwindcss/oxide-darwin-arm64": {
"version": "4.3.0", "version": "4.3.1",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.3.0.tgz", "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.3.1.tgz",
"integrity": "sha512-oMN/WZRb+SO37BmUElEgeEWuU8E/HXRkiODxJxLe1UTHVXLrdVSgfaJV7pSlhRGMSOiXLuxTIjfsF3wYvz8cgQ==", "integrity": "sha512-hVnWLwv+e/l7c4WKyVtHVrIPvYdqWHjRB3MDIqARynzFtnQg85kmQEFCbV9Ja0VVx4xXTIiDWY60Y7iz/iNoDA==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -2088,9 +2088,9 @@
} }
}, },
"node_modules/@tailwindcss/oxide-darwin-x64": { "node_modules/@tailwindcss/oxide-darwin-x64": {
"version": "4.3.0", "version": "4.3.1",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-x64/-/oxide-darwin-x64-4.3.0.tgz", "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-x64/-/oxide-darwin-x64-4.3.1.tgz",
"integrity": "sha512-N6CUmu4a6bKVADfw77p+iw6Yd9Q3OBhe0veaDX+QazfuVYlQsHfDgxBrsjQ/IW+zywL8mTrNd0SdJT/zgtvMdA==", "integrity": "sha512-Cf7abu0WVgbhU7ANgPUnSAvm7nCvMweusHb8FnaHlLfv/Caq4GYaEZg7ZImzzmjx4lIAfuS8q+eLIS7A7IzxIg==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -2105,9 +2105,9 @@
} }
}, },
"node_modules/@tailwindcss/oxide-freebsd-x64": { "node_modules/@tailwindcss/oxide-freebsd-x64": {
"version": "4.3.0", "version": "4.3.1",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-freebsd-x64/-/oxide-freebsd-x64-4.3.0.tgz", "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-freebsd-x64/-/oxide-freebsd-x64-4.3.1.tgz",
"integrity": "sha512-zDL5hBkQdH5C6MpqbK3gQAgP80tsMwSI26vjOzjJtNCMUo0lFgOItzHKBIupOZNQxt3ouPH7RPhvNhiTfCe5CQ==", "integrity": "sha512-ZZqzX2Y+GXtXXfqSfpJhDm60OoZfvLHLCgm+J7NVqgHHJjG/m9ugZI77RwTsVd4fnBJuCFP6Ae6kTJb71UdS8g==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -2122,9 +2122,9 @@
} }
}, },
"node_modules/@tailwindcss/oxide-linux-arm-gnueabihf": { "node_modules/@tailwindcss/oxide-linux-arm-gnueabihf": {
"version": "4.3.0", "version": "4.3.1",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm-gnueabihf/-/oxide-linux-arm-gnueabihf-4.3.0.tgz", "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm-gnueabihf/-/oxide-linux-arm-gnueabihf-4.3.1.tgz",
"integrity": "sha512-R06HdNi7A7OEoMsf6d4tjZ71RCWnZQPHj2mnotSFURjNLdBC+cIgXQ7l81CqeoiQftjf6OOblxXMInMgN2VzMA==", "integrity": "sha512-/Ah/xik0LaMYfv9DZ0S/t4pBlBNYOcqtRwusjgovHkvT8ixueWCLyJjsaF5kQIckjb4IT8Q6K6p/iPmZMixYgg==",
"cpu": [ "cpu": [
"arm" "arm"
], ],
@@ -2139,9 +2139,9 @@
} }
}, },
"node_modules/@tailwindcss/oxide-linux-arm64-gnu": { "node_modules/@tailwindcss/oxide-linux-arm64-gnu": {
"version": "4.3.0", "version": "4.3.1",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-gnu/-/oxide-linux-arm64-gnu-4.3.0.tgz", "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-gnu/-/oxide-linux-arm64-gnu-4.3.1.tgz",
"integrity": "sha512-qTJHELX8jetjhRQHCLilkVLmybpzNQAtaI/gaoVoidn/ufbNDbAo8KlK2J+yPoc8wQxvDxCmh/5lr8nC1+lTbg==", "integrity": "sha512-gqdFoVJlw444GvpnheZLHmvTzSxI/cOUUh2KSNejQjTcYkW062SVD+En0rUgD+QV91bz1XGIGtt1HJd48xUGbQ==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -2156,9 +2156,9 @@
} }
}, },
"node_modules/@tailwindcss/oxide-linux-arm64-musl": { "node_modules/@tailwindcss/oxide-linux-arm64-musl": {
"version": "4.3.0", "version": "4.3.1",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-musl/-/oxide-linux-arm64-musl-4.3.0.tgz", "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-musl/-/oxide-linux-arm64-musl-4.3.1.tgz",
"integrity": "sha512-Z6sukiQsngnWO+l39X4pPbiWT81IC+PLKF+PHxIlyZbGNb9MODfYlXEVlFvej5BOZInWX01kVyzeLvHsXhfczQ==", "integrity": "sha512-Bwv9KwOvE0VKa86xPFif9b9c3Y1NxOV1P0gLti/IYaWEsQYZXDlxfGEtA8mdDZ7SG3wyNXAWYT5SIn3giL57oA==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -2173,9 +2173,9 @@
} }
}, },
"node_modules/@tailwindcss/oxide-linux-x64-gnu": { "node_modules/@tailwindcss/oxide-linux-x64-gnu": {
"version": "4.3.0", "version": "4.3.1",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-gnu/-/oxide-linux-x64-gnu-4.3.0.tgz", "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-gnu/-/oxide-linux-x64-gnu-4.3.1.tgz",
"integrity": "sha512-DRNdQRpSGzRGfARVuVkxvM8Q12nh19l4BF/G7zGA1oe+9wcC6saFBHTISrpIcKzhiXtSrlSrluCfvMuledoCTQ==", "integrity": "sha512-Ymi8O8T15HYQdOUWUtTI6ldN0neHP85FC+Qz32xTcZ7iJXtem/x8ITev0o1e9e5rkqj4lONZfTRLvkmin1+tKg==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -2190,9 +2190,9 @@
} }
}, },
"node_modules/@tailwindcss/oxide-linux-x64-musl": { "node_modules/@tailwindcss/oxide-linux-x64-musl": {
"version": "4.3.0", "version": "4.3.1",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-musl/-/oxide-linux-x64-musl-4.3.0.tgz", "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-musl/-/oxide-linux-x64-musl-4.3.1.tgz",
"integrity": "sha512-Z0IADbDo8bh6I7h2IQMx601AdXBLfFpEdUotft86evd/8ZPflZe9COPO8Q1vw+pfLWIUo9zN/JGZvwuAJqduqg==", "integrity": "sha512-M+P/91qJ6uILLw4k2G93GMDRAXj61SMvFQYt39AqvUqYgExXpLL5aepfns7sj4HiAQeolirQF9E0lzRvdf4zPQ==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -2207,9 +2207,9 @@
} }
}, },
"node_modules/@tailwindcss/oxide-wasm32-wasi": { "node_modules/@tailwindcss/oxide-wasm32-wasi": {
"version": "4.3.0", "version": "4.3.1",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-wasm32-wasi/-/oxide-wasm32-wasi-4.3.0.tgz", "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-wasm32-wasi/-/oxide-wasm32-wasi-4.3.1.tgz",
"integrity": "sha512-HNZGOUxEmElksYR7S6sC5jTeNGpobAsy9u7Gu0AskJ8/20FR9GqebUyB+HBcU/ax6BHuiuJi+Oda4B+YX6H1yA==", "integrity": "sha512-zsM8uOeqvVGHsAXsJxsT28ttosFahLJKCLOTUBqRAtKnVgGSRitds9T432QiT8b77Yga7JIBkulIRRlJPtYhRA==",
"bundleDependencies": [ "bundleDependencies": [
"@napi-rs/wasm-runtime", "@napi-rs/wasm-runtime",
"@emnapi/core", "@emnapi/core",
@@ -2229,7 +2229,7 @@
"@emnapi/runtime": "^1.10.0", "@emnapi/runtime": "^1.10.0",
"@emnapi/wasi-threads": "^1.2.1", "@emnapi/wasi-threads": "^1.2.1",
"@napi-rs/wasm-runtime": "^1.1.4", "@napi-rs/wasm-runtime": "^1.1.4",
"@tybys/wasm-util": "^0.10.1", "@tybys/wasm-util": "^0.10.2",
"tslib": "^2.8.1" "tslib": "^2.8.1"
}, },
"engines": { "engines": {
@@ -2237,9 +2237,9 @@
} }
}, },
"node_modules/@tailwindcss/oxide-win32-arm64-msvc": { "node_modules/@tailwindcss/oxide-win32-arm64-msvc": {
"version": "4.3.0", "version": "4.3.1",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.3.0.tgz", "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.3.1.tgz",
"integrity": "sha512-Pe+RPVTi1T+qymuuRpcdvwSVZjnll/f7n8gBxMMh3xLTctMDKqpdfGimbMyioqtLhUYZxdJ9wGNhV7MKHvgZsQ==", "integrity": "sha512-aiNvSq9BsVk8V513lDKlrCFAgf8qBMPZTpgEhInL+NwQqs97mYmupVMrPrgBBSL8Pv/0zXu9MrMF9rMun1ZeNg==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -2254,9 +2254,9 @@
} }
}, },
"node_modules/@tailwindcss/oxide-win32-x64-msvc": { "node_modules/@tailwindcss/oxide-win32-x64-msvc": {
"version": "4.3.0", "version": "4.3.1",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.3.0.tgz", "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.3.1.tgz",
"integrity": "sha512-Mvrf2kXW/yeW/OTezZlCGOirXRcUuLIBx/5Y12BaPM7wJoryG6dfS/NJL8aBPqtTEx/Vm4T4vKzFUcKDT+TKUA==", "integrity": "sha512-xDEyu1rg290472FEGaKHnzyDyh5QH+AlWvsU5hMoMtPpzmKlRI0jaYKCgSHDYtaQWZOYbMaduSyCwFwY4n1HmA==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -2271,30 +2271,30 @@
} }
}, },
"node_modules/@tailwindcss/postcss": { "node_modules/@tailwindcss/postcss": {
"version": "4.3.0", "version": "4.3.1",
"resolved": "https://registry.npmjs.org/@tailwindcss/postcss/-/postcss-4.3.0.tgz", "resolved": "https://registry.npmjs.org/@tailwindcss/postcss/-/postcss-4.3.1.tgz",
"integrity": "sha512-Jm05Tjx+9yCLGv5qw1c+84Psds8MnyrEQYCB+FFk2lgGiUjlRqdxke4mVTuYrj2xnVZqKim2Apr5ySuQRYAw/w==", "integrity": "sha512-dNJuNbdEJT/SWRuXTYP1WSamelsz3ztkUsdtWQPjrexysrTpaEPM40P/71knXiXLYEojqPOEGitVLLpPMS5T6A==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@alloc/quick-lru": "^5.2.0", "@alloc/quick-lru": "^5.2.0",
"@tailwindcss/node": "4.3.0", "@tailwindcss/node": "4.3.1",
"@tailwindcss/oxide": "4.3.0", "@tailwindcss/oxide": "4.3.1",
"postcss": "^8.5.10", "postcss": "8.5.15",
"tailwindcss": "4.3.0" "tailwindcss": "4.3.1"
} }
}, },
"node_modules/@tailwindcss/typography": { "node_modules/@tailwindcss/typography": {
"version": "0.5.19", "version": "0.5.20",
"resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.19.tgz", "resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.20.tgz",
"integrity": "sha512-w31dd8HOx3k9vPtcQh5QHP9GwKcgbMp87j58qi6xgiBnFFtKEAgCWnDw4qUT8aHwkCp8bKvb/KGKWWHedP0AAg==", "integrity": "sha512-hwbzQuNUfcPvbegQFatVPl/MY/tcM9KLl963hQ5laJKPh81TEZ1+dNG9PirGvcaDBkp+BCshExAyKVPW91dozw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"postcss-selector-parser": "6.0.10" "postcss-selector-parser": "6.0.10"
}, },
"peerDependencies": { "peerDependencies": {
"tailwindcss": ">=3.0.0 || insiders || >=4.0.0-alpha.20 || >=4.0.0-beta.1" "tailwindcss": ">=3.0.0 || >=4.0.0 || insiders"
} }
}, },
"node_modules/@tsconfig/svelte": { "node_modules/@tsconfig/svelte": {
@@ -2760,9 +2760,9 @@
} }
}, },
"node_modules/daisyui": { "node_modules/daisyui": {
"version": "5.5.20", "version": "5.5.23",
"resolved": "https://registry.npmjs.org/daisyui/-/daisyui-5.5.20.tgz", "resolved": "https://registry.npmjs.org/daisyui/-/daisyui-5.5.23.tgz",
"integrity": "sha512-HemJcjl0Gk9rQ8BcgofN6p+EURrqftQG9wK1Hkxs98i49xe68+QxpNvry+PyxwkIUgrbMpNmZ5ZWjmtffAjfhQ==", "integrity": "sha512-xuheNUSL4T6ZVtWXoioqcNkjoyGX85QTDz4HTw2aBPfqk4fuMjax5HDo8qCmpV6M1YN8bGvfx5BpYCoDeRlt+A==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"funding": { "funding": {
@@ -2885,9 +2885,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/enhanced-resolve": { "node_modules/enhanced-resolve": {
"version": "5.21.2", "version": "5.21.6",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.21.2.tgz", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.21.6.tgz",
"integrity": "sha512-xe9vQb5kReirPUxgQrXA3ihgbCqssmTiM7cOZ+Gzu+VeGWgpV98lLZvp0dl4yriyAePcewxGUs9UpKD8PET9KQ==", "integrity": "sha512-aNnGCvbJ/RIyWo1IuhNdVjnNF+EjH9wpzpNHt+ci/m9He9LJvUN8wrCcXjp9cWsGNAuvSpVFTx/vraAFQ8qGjQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -3207,9 +3207,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/jiti": { "node_modules/jiti": {
"version": "2.6.1", "version": "2.7.0",
"resolved": "https://registry.npmjs.org/jiti/-/jiti-2.6.1.tgz", "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.7.0.tgz",
"integrity": "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==", "integrity": "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"bin": { "bin": {
@@ -4126,9 +4126,9 @@
} }
}, },
"node_modules/svelte": { "node_modules/svelte": {
"version": "5.56.2", "version": "5.56.3",
"resolved": "https://registry.npmjs.org/svelte/-/svelte-5.56.2.tgz", "resolved": "https://registry.npmjs.org/svelte/-/svelte-5.56.3.tgz",
"integrity": "sha512-1lDf8TLqpxyAt3xgybfytWPJQbaUD6TiDgpiCLH0BKrKEwzecB9pjuNVnEJMpzH018xUzo6oxheK2HT0oa2RoQ==", "integrity": "sha512-w7JvrM5IFl5cmfbY0TLik9o7mjRUJmRMhOR51tBPu708Gr/MjbGs7VnJnr/B0CaXeI4vtnOh7RKxDr0cwhMdDA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -4242,9 +4242,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/tailwindcss": { "node_modules/tailwindcss": {
"version": "4.3.0", "version": "4.3.1",
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.3.0.tgz", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.3.1.tgz",
"integrity": "sha512-y6nxMGB1nMW9R6k96e5gdIFzcfL/gTJRNaqGes1YvkLnPVXzWgbqFF2yLC0T8G774n24cx3Pe8XrKoniCOAH+Q==", "integrity": "sha512-hk+TB1m+K8CYNrP6rjQaq/Y+4Zylwpa87mLYBKCunwnnQ9p+fHb7kmSfGqyEJoxF/O6CDyABWVFEafNSYKll+Q==",
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
+6 -6
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-web", "name": "playlet-web",
"version": "0.46.0", "version": "0.47.3",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
@@ -10,22 +10,22 @@
}, },
"devDependencies": { "devDependencies": {
"@sveltejs/vite-plugin-svelte": "^7.1.2", "@sveltejs/vite-plugin-svelte": "^7.1.2",
"@tailwindcss/postcss": "^4.3.0", "@tailwindcss/postcss": "^4.3.1",
"@tailwindcss/typography": "^0.5.19", "@tailwindcss/typography": "^0.5.20",
"@tsconfig/svelte": "^5.0.8", "@tsconfig/svelte": "^5.0.8",
"@vitejs/plugin-legacy": "^8.0.2", "@vitejs/plugin-legacy": "^8.0.2",
"autoprefixer": "^10.5.0", "autoprefixer": "^10.5.0",
"bgutils-js": "^3.2.0", "bgutils-js": "^3.2.0",
"daisyui": "^5.5.20", "daisyui": "^5.5.23",
"dotenv": "^17.4.2", "dotenv": "^17.4.2",
"ip": "^2.0.1", "ip": "^2.0.1",
"jszip": "^3.10.1", "jszip": "^3.10.1",
"postcss": "^8.5.15", "postcss": "^8.5.15",
"rollup-plugin-visualizer": "^7.0.1", "rollup-plugin-visualizer": "^7.0.1",
"svelte": "^5.56.2", "svelte": "^5.56.3",
"svelte-check": "^4.6.0", "svelte-check": "^4.6.0",
"svelte-preprocess": "6.0.3", "svelte-preprocess": "6.0.3",
"tailwindcss": "^4.3.0", "tailwindcss": "^4.3.1",
"terser": "^5.48.0", "terser": "^5.48.0",
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.9.3", "typescript": "^5.9.3",
@@ -1,17 +1,29 @@
<script lang="ts"> <script lang="ts">
import { PlayletApi } from "lib/Api/PlayletApi"; import { PlayletApi } from "lib/Api/PlayletApi";
import { translate, userPreferencesStore } from "lib/Stores"; import { playletStateStore, translate, userPreferencesStore } from "lib/Stores";
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"]; const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
const qualityLabels = {
auto: "Auto", function makeQualityLabels(canDecodeAv1: boolean) {
"1080p": "1080p", return {
"720p": "720p", auto: "Auto",
"480p": "480p", ...(canDecodeAv1 ? { "2160p": "2160p", "1440p": "1440p" } : {}),
"360p": "360p", "1080p": "1080p",
"240p": "240p", "720p": "720p",
"144p": "144p", "480p": "480p",
}; "360p": "360p",
"240p": "240p",
"144p": "144p",
};
}
let qualityLabels = makeQualityLabels(false);
playletStateStore.subscribe((state) => {
qualityLabels = makeQualityLabels(
(state.device || {})["can_decode_av1"] === true
);
});
export let displayText: string = ""; export let displayText: string = "";
export let key: string = ""; export let key: string = "";
+2 -1
View File
@@ -13,6 +13,7 @@ import {
import path from "path"; import path from "path";
import { SGNode, SGScript } from "brighterscript/dist/parser/SGTypes"; import { SGNode, SGScript } from "brighterscript/dist/parser/SGTypes";
import { RawCodeStatement } from "./Classes/RawCodeStatement"; import { RawCodeStatement } from "./Classes/RawCodeStatement";
import { exitOnCriticalErrors } from './critical-exit';
const bindings_function_name = 'InitializeBindings'; const bindings_function_name = 'InitializeBindings';
@@ -198,5 +199,5 @@ export class BindingsPlugin implements CompilerPlugin {
} }
export default () => { export default () => {
return new BindingsPlugin(); return exitOnCriticalErrors(new BindingsPlugin());
}; };
@@ -13,6 +13,7 @@ import { SGChildren, SGComponent, SGInterface, SGScript } from 'brighterscript/d
import { globSync } from 'glob'; import { globSync } from 'glob';
import fs from 'fs-extra' import fs from 'fs-extra'
import path from 'path'; import path from 'path';
import { exitOnCriticalErrors } from './critical-exit';
export class ComponentIncludesPlugin implements CompilerPlugin { export class ComponentIncludesPlugin implements CompilerPlugin {
public name = 'ComponentIncludesPlugin'; public name = 'ComponentIncludesPlugin';
@@ -160,5 +161,5 @@ export class ComponentIncludesPlugin implements CompilerPlugin {
} }
export default () => { export default () => {
return new ComponentIncludesPlugin(); return exitOnCriticalErrors(new ComponentIncludesPlugin());
}; };
@@ -0,0 +1,28 @@
import { CompilerPlugin, ProgramBuilder } from 'brighterscript';
// A plugin that fails to load (e.g. a TypeScript error in its file) is only logged
// by bsc and the build continues without it, exiting 0 (rokucommunity/brighterscript#1675).
// Listed last in the plugins array, this guard fails the command when any configured
// plugin is missing from the loaded set. It deliberately imports nothing from the
// other plugin files, so it still loads when one of them is broken.
const exitOnError = !!process.env.npm_lifecycle_event && !process.argv.includes('--lsp');
export class CriticalExitGuardPlugin implements CompilerPlugin {
public name = 'CriticalExitGuardPlugin';
beforeProgramCreate(builder: ProgramBuilder) {
if (!exitOnError) {
return;
}
const configured = (builder as any)?.options?.plugins?.length ?? 0;
const loaded = (builder as any)?.plugins?.plugins?.length ?? 0;
if (loaded < configured) {
console.error(`${configured - loaded} of ${configured} configured plugins failed to load (see "Error when loading plugin" above)`);
process.exit(1);
}
}
}
export default () => {
return new CriticalExitGuardPlugin();
};
+37
View File
@@ -0,0 +1,37 @@
import { Plugin } from 'brighterscript';
// bsc catches plugin exceptions and only logs them (rokucommunity/brighterscript#1675),
// so a crashing plugin still yields a passing build/lint. When running under an npm
// script (build, lint, test) an uncaught plugin error must fail the command, so every
// hook is wrapped to exit non-zero. Long-lived hosts (LSP) keep log-and-continue.
const exitOnError = !!process.env.npm_lifecycle_event && !process.argv.includes('--lsp');
export function exitOnCriticalErrors<T extends Plugin>(plugin: T): T {
if (!exitOnError) {
return plugin;
}
return new Proxy(plugin, {
get(target, prop) {
const value = (target as any)[prop];
if (typeof value !== 'function') {
return value;
}
return (...args: unknown[]) => {
try {
const result = value.apply(target, args);
if (result instanceof Promise) {
return result.catch((err: unknown) => exitCritically(target.name, prop, err));
}
return result;
} catch (err) {
exitCritically(target.name, prop, err);
}
};
},
});
}
function exitCritically(pluginName: string, hook: PropertyKey, err: unknown): never {
console.error(`Plugin ${pluginName} failed in ${String(hook)}:`, err instanceof Error ? (err.stack || err.message) : err);
process.exit(1);
}
+2 -1
View File
@@ -11,6 +11,7 @@ import {
} from 'brighterscript'; } from 'brighterscript';
import { existsSync } from 'fs-extra'; import { existsSync } from 'fs-extra';
import path from 'path'; import path from 'path';
import { exitOnCriticalErrors } from './critical-exit';
export class ImportValidationPlugin implements CompilerPlugin { export class ImportValidationPlugin implements CompilerPlugin {
public name = 'ImportValidationPlugin'; public name = 'ImportValidationPlugin';
@@ -45,5 +46,5 @@ export class ImportValidationPlugin implements CompilerPlugin {
} }
export default () => { export default () => {
return new ImportValidationPlugin(); return exitOnCriticalErrors(new ImportValidationPlugin());
}; };
+2 -1
View File
@@ -11,6 +11,7 @@ import {
DiagnosticSeverity, DiagnosticSeverity,
} from 'brighterscript'; } from 'brighterscript';
import path from 'path'; import path from 'path';
import { exitOnCriticalErrors } from './critical-exit';
export class JobSystemPlugin implements CompilerPlugin { export class JobSystemPlugin implements CompilerPlugin {
public name = 'JobSystemPlugin'; public name = 'JobSystemPlugin';
@@ -115,5 +116,5 @@ export class JobSystemPlugin implements CompilerPlugin {
} }
export default () => { export default () => {
return new JobSystemPlugin(); return exitOnCriticalErrors(new JobSystemPlugin());
}; };
+2 -1
View File
@@ -7,6 +7,7 @@ import path from 'path';
import fs from 'fs-extra' import fs from 'fs-extra'
import json5 from 'json5'; import json5 from 'json5';
import YAML from "yaml"; import YAML from "yaml";
import { exitOnCriticalErrors } from './critical-exit';
const jsonExtensions = ['.json', '.jsonc', '.json5']; const jsonExtensions = ['.json', '.jsonc', '.json5'];
const yamlExtensions = ['.yaml', '.yml']; const yamlExtensions = ['.yaml', '.yml'];
@@ -40,5 +41,5 @@ export class JsonYamlPlugin implements CompilerPlugin {
} }
export default () => { export default () => {
return new JsonYamlPlugin(); return exitOnCriticalErrors(new JsonYamlPlugin());
}; };
+2 -1
View File
@@ -27,6 +27,7 @@ import { globSync } from 'glob';
import { SGNode } from "brighterscript/dist/parser/SGTypes"; import { SGNode } from "brighterscript/dist/parser/SGTypes";
import json5 from 'json5'; import json5 from 'json5';
import YAML from "yaml"; import YAML from "yaml";
import { exitOnCriticalErrors } from './critical-exit';
const translatableXmlAttributes = ["text", "title", "short_title", "primaryTitle", "displayText", "description"]; const translatableXmlAttributes = ["text", "title", "short_title", "primaryTitle", "displayText", "description"];
@@ -417,5 +418,5 @@ export class LocaleValidationPlugin implements CompilerPlugin {
} }
export default () => { export default () => {
return new LocaleValidationPlugin(); return exitOnCriticalErrors(new LocaleValidationPlugin());
}; };
+2 -1
View File
@@ -16,6 +16,7 @@ import {
isBrsFile, isBrsFile,
} from 'brighterscript'; } from 'brighterscript';
import path from 'path'; import path from 'path';
import { exitOnCriticalErrors } from './critical-exit';
const loggingFilePath = path.join('source', 'utils', 'Logging.bs'); const loggingFilePath = path.join('source', 'utils', 'Logging.bs');
const logFunctions = { const logFunctions = {
@@ -250,5 +251,5 @@ function ${newFunctionName}(${args.join(', ')}) as void
} }
export default () => { export default () => {
return new LoggerPlugin(); return exitOnCriticalErrors(new LoggerPlugin());
}; };
+33 -3
View File
@@ -6,6 +6,10 @@
// - DEBUG_HOST_IP_ADDRESS would be replaced with the host IP address in the manifest file // - DEBUG_HOST_IP_ADDRESS would be replaced with the host IP address in the manifest file
// - This is to playlet app to pull playlet lib from the locally hosted server // - This is to playlet app to pull playlet lib from the locally hosted server
// - This is only done when --debug is set // - This is only done when --debug is set
// - PLAYLET_DEVTOOLS (env) instead points playlet_lib_zip_debug_url at the dev-tools service:
// the freshly-built lib zip is registered with it and its URL baked in, so rebuilding the lib
// and relaunching hot-reloads it with no app redeploy. Opt-in; only the app manifest has the
// key, so the lib build and every normal build keep the :8086 host the VSCode launch serves.
import { import {
BeforeProgramDisposeEvent, BeforeProgramDisposeEvent,
@@ -15,6 +19,8 @@ import {
} from 'brighterscript'; } from 'brighterscript';
import path from 'path'; import path from 'path';
import fs from 'fs'; import fs from 'fs';
import { execFileSync } from 'child_process';
import { exitOnCriticalErrors } from './critical-exit';
const ip = require('ip'); const ip = require('ip');
export class ManifestEditPlugin implements CompilerPlugin { export class ManifestEditPlugin implements CompilerPlugin {
@@ -23,6 +29,15 @@ export class ManifestEditPlugin implements CompilerPlugin {
private originalManifestContent?: string; private originalManifestContent?: string;
beforeProgramCreate(builder: ProgramBuilder) { beforeProgramCreate(builder: ProgramBuilder) {
// The language server loads this plugin too (VS Code + bsc-lsp), and its revalidate cycle would
// restore a stale cached copy of the manifest over genuine build edits. The LSP builds no-emit
// with showDiagnosticsInConsole off (it reports over the protocol); builds and bslint leave it
// on. So that flag marks the analysis-only editor pass — skip the manifest rewrite there.
// @ts-ignore
if (builder.options.showDiagnosticsInConsole === false) {
return;
}
const manifestPath = path.join(builder.options.rootDir!, "manifest") const manifestPath = path.join(builder.options.rootDir!, "manifest")
let originalManifestContent = fs.readFileSync(manifestPath, { encoding: 'utf8', flag: 'r' }) let originalManifestContent = fs.readFileSync(manifestPath, { encoding: 'utf8', flag: 'r' })
@@ -35,8 +50,23 @@ export class ManifestEditPlugin implements CompilerPlugin {
manifestContent = manifestContent.replace(/DEBUG=(true|false)/i, `DEBUG=${debug}`); manifestContent = manifestContent.replace(/DEBUG=(true|false)/i, `DEBUG=${debug}`);
if (debug) { if (debug) {
// Host IP address // dev-tools service hosts the lib (opt-in via PLAYLET_DEVTOOLS); the key lives only in
manifestContent = manifestContent.replace(/DEBUG_HOST_IP_ADDRESS/i, `${ip.address()}`) // the app manifest, so the lib build and normal builds fall through to the :8086 host.
if (process.env.PLAYLET_DEVTOOLS && /playlet_lib_zip_debug_url=/.test(manifestContent)) {
const serveScript = path.resolve(builder.options.rootDir!, '../../../../dev-tools/bin/serve.sh')
const libZip = path.resolve(builder.options.rootDir!, '../../dist/playlet-lib.zip')
let url: string
try {
url = execFileSync(serveScript, ['add', libZip], { encoding: 'utf8' }).trim()
} catch (err: any) {
throw new Error(`Could not host ${libZip} via the dev-tools service (is it running? cd dev-tools && npm start): ${err?.message ?? err}`)
}
builder.logger.log(`Hosting playlet-lib.zip via dev-tools service: ${url}`)
manifestContent = manifestContent.replace(/playlet_lib_zip_debug_url=.*/i, `playlet_lib_zip_debug_url=${url}`)
} else {
// Host IP address
manifestContent = manifestContent.replace(/DEBUG_HOST_IP_ADDRESS/i, `${ip.address()}`)
}
} }
// Test flag // Test flag
@@ -76,5 +106,5 @@ export class ManifestEditPlugin implements CompilerPlugin {
} }
export default () => { export default () => {
return new ManifestEditPlugin(); return exitOnCriticalErrors(new ManifestEditPlugin());
}; };
+2 -1
View File
@@ -18,6 +18,7 @@ import {
} from 'brighterscript'; } from 'brighterscript';
import path from 'path'; import path from 'path';
import fs from 'fs'; import fs from 'fs';
import { exitOnCriticalErrors } from './critical-exit';
function copyDirSync(src: string, dest: string): void { function copyDirSync(src: string, dest: string): void {
fs.mkdirSync(dest, { recursive: true }); fs.mkdirSync(dest, { recursive: true });
@@ -82,5 +83,5 @@ export class OdcPlugin implements CompilerPlugin {
} }
export default () => { export default () => {
return new OdcPlugin(); return exitOnCriticalErrors(new OdcPlugin());
}; };
+2 -1
View File
@@ -17,6 +17,7 @@ import {
} from 'brighterscript'; } from 'brighterscript';
import { RawCodeStatement } from './Classes/RawCodeStatement'; import { RawCodeStatement } from './Classes/RawCodeStatement';
import { exitOnCriticalErrors } from './critical-exit';
// The plugin processes the file that includes the Init function, not the file that includes the @oninit functions // The plugin processes the file that includes the Init function, not the file that includes the @oninit functions
// This is because the modifications will be made to the Init function. // This is because the modifications will be made to the Init function.
@@ -209,5 +210,5 @@ export class OnInitPlugin implements CompilerPlugin {
} }
export default () => { export default () => {
return new OnInitPlugin(); return exitOnCriticalErrors(new OnInitPlugin());
}; };
+2 -1
View File
@@ -9,6 +9,7 @@ import { globSync } from 'glob';
import path from 'path'; import path from 'path';
import md5 from 'crypto-js/md5'; import md5 from 'crypto-js/md5';
import { Formatter, Runner } from 'brighterscript-formatter'; import { Formatter, Runner } from 'brighterscript-formatter';
import { exitOnCriticalErrors } from './critical-exit';
const protobufSchema = require('protocol-buffers-schema') const protobufSchema = require('protocol-buffers-schema')
export class ProtoGenPlugin implements CompilerPlugin { export class ProtoGenPlugin implements CompilerPlugin {
@@ -275,5 +276,5 @@ end function`;
} }
export default () => { export default () => {
return new ProtoGenPlugin(); return exitOnCriticalErrors(new ProtoGenPlugin());
}; };
+2 -1
View File
@@ -9,6 +9,7 @@ import {
Range, Range,
isBrsFile isBrsFile
} from 'brighterscript'; } from 'brighterscript';
import { exitOnCriticalErrors } from './critical-exit';
type Validation = { type Validation = {
code: number | string | undefined; code: number | string | undefined;
@@ -76,5 +77,5 @@ export class ValidationPlugin implements CompilerPlugin {
} }
export default () => { export default () => {
return new ValidationPlugin(); return exitOnCriticalErrors(new ValidationPlugin());
}; };
+2 -1
View File
@@ -16,6 +16,7 @@ import {
isBrsFile isBrsFile
} from "brighterscript"; } from "brighterscript";
import { RawCodeStatement } from "./Classes/RawCodeStatement"; import { RawCodeStatement } from "./Classes/RawCodeStatement";
import { exitOnCriticalErrors } from './critical-exit';
const annotationNames = ['all', 'get', 'post', 'put', 'delete', 'patch', 'head', 'options']; const annotationNames = ['all', 'get', 'post', 'put', 'delete', 'patch', 'head', 'options'];
const httpRouterBaseClass = 'HttpRouter'; const httpRouterBaseClass = 'HttpRouter';
@@ -155,5 +156,5 @@ export class WebServerPlugin implements CompilerPlugin {
} }
export default () => { export default () => {
return new WebServerPlugin(); return exitOnCriticalErrors(new WebServerPlugin());
}; };
+15 -35
View File
@@ -64,6 +64,7 @@ const imap = new Imap({
const searchAsync = promisify(imap.search).bind(imap); const searchAsync = promisify(imap.search).bind(imap);
const openBoxAsync = promisify(imap.openBox).bind(imap); const openBoxAsync = promisify(imap.openBox).bind(imap);
const moveAsync = promisify(imap.move).bind(imap);
async function getAttachementAsync(from, subject, since) { async function getAttachementAsync(from, subject, since) {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
@@ -116,36 +117,16 @@ async function getAttachementAsync(from, subject, since) {
} }
async function moveToTrash(from, subject, since) { async function moveToTrash(from, subject, since) {
return new Promise(async (resolve, reject) => { // imap.search returns UIDs (UID SEARCH), so move them directly with a single
const results = await searchAsync([['FROM', from], ['SUBJECT', subject], ['SINCE', since]]); // UID MOVE command. Moving inside an active imap.fetch loop expunges messages
const fetch = imap.fetch(results, { bodies: '' }); // from INBOX mid-fetch, which desyncs sequence numbers and hangs the connection.
const uids = await searchAsync([['FROM', from], ['SUBJECT', subject], ['SINCE', since]]);
fetch.on('message', function (msg, seqno) { if (uids.length === 0) {
console.log('Processing message #%d', seqno); console.log('No messages to move to Trash for subject "%s"', subject);
return;
msg.on('attributes', attributes => { }
imap.move([attributes.uid], '[Gmail]/Trash', function (err) { await moveAsync(uids, '[Gmail]/Trash');
if (err) { console.log('Moved %d message(s) to Trash for subject "%s"', uids.length, subject);
console.error(err);
reject(err);
} else {
console.log('Moved message #%d to Trash', seqno);
}
});
});
msg.once('error', err => reject(err));
msg.once('end', function () {
console.log('Finished processing message #%d', seqno);
});
});
fetch.once('end', function () {
console.log('All messages processed');
resolve();
});
});
} }
const timeout = setTimeout(() => { const timeout = setTimeout(() => {
@@ -183,11 +164,10 @@ imap.once('ready', async () => {
writeMarkDownFile(images); writeMarkDownFile(images);
// TODO:P0 deleting emails hangs the process, so it's disabled for now await moveToTrash('bdp_noreply@data.roku.com', 'App Health', yesterdayString);
// await moveToTrash('bdp_noreply@data.roku.com', 'App Health', yesterdayString); await moveToTrash('bdp_noreply@data.roku.com', 'App Engagement', yesterdayString);
// await moveToTrash('bdp_noreply@data.roku.com', 'App Engagement', yesterdayString); await moveToTrash('bdp_noreply@data.roku.com', 'Viewership Summary', yesterdayString);
// await moveToTrash('bdp_noreply@data.roku.com', 'Viewership Summary', yesterdayString); await moveToTrash('bdp_noreply@data.roku.com', 'App Stability', yesterdayString);
// await moveToTrash('bdp_noreply@data.roku.com', 'App Stability', yesterdayString);
imap.end(); imap.end();
} catch (error) { } catch (error) {