Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c75903d11 | ||
|
|
e2e3e3099f | ||
|
|
3381d19b53 | ||
|
|
0f2a1a2b16 | ||
|
|
38bfa1a102 | ||
|
|
fbb4a45ce5 | ||
|
|
8dd24ddb43 | ||
|
|
fbf8e0a499 | ||
|
|
c81f5cd9e1 | ||
|
|
17ff6b940b | ||
|
|
2e1a4c9ea3 | ||
|
|
bd01da01e6 | ||
|
|
333553790f | ||
|
|
422d58508e | ||
|
|
430fef1585 | ||
|
|
4754e1620b | ||
|
|
5c5fe19440 | ||
|
|
ce32d2f762 | ||
|
|
63f9ac693a | ||
|
|
5e798f19de | ||
|
|
6a4a61b61f | ||
|
|
7e21e46ec0 | ||
|
|
5e34ce8067 | ||
|
|
9d23efe7e6 | ||
|
|
7f7cf55486 | ||
|
|
ef39f1c34b | ||
|
|
98d81a4773 | ||
|
|
7310befaaf | ||
|
|
4d047909fc | ||
|
|
105b9ab12c | ||
|
|
4588e9dbbb | ||
|
|
95dff3bc07 | ||
|
|
9980b591b3 | ||
|
|
e8f1a98cfe | ||
|
|
513c13420a | ||
|
|
c32431fefc | ||
|
|
d03909f8d6 | ||
|
|
bbabb3184d | ||
|
|
354acad5a6 | ||
|
|
a2e56dd700 | ||
|
|
0f33f72cc1 | ||
|
|
0c7bd4b3e0 | ||
|
|
f7c508f8db | ||
|
|
62dcc14042 | ||
|
|
7a976bbe3d | ||
|
|
2830311aa8 | ||
|
|
cdee8a713b | ||
|
|
986be7e224 | ||
|
|
dd8c1b4e28 | ||
|
|
dcd6def22b | ||
|
|
ef83b598eb | ||
|
|
35b38c7cd8 | ||
|
|
c0dce836cf | ||
|
|
29dd94352e | ||
|
|
21c0900fac | ||
|
|
9b8e55e8ec | ||
|
|
a19945b4b9 | ||
|
|
7bdd9c1671 | ||
|
|
b08a18b191 | ||
|
|
3e3339a095 | ||
|
|
1ba454cdab | ||
|
|
8c11272b92 | ||
|
|
f4ad005256 | ||
|
|
fc4bca8359 | ||
|
|
a7fdf95e1f | ||
|
|
f81907c2ff | ||
|
|
0c7a3f36f8 | ||
|
|
425f4d9660 | ||
|
|
99f606610c | ||
|
|
62b4a90a7e | ||
|
|
ee98f0f368 | ||
|
|
81db556699 | ||
|
|
81ee5b3262 | ||
|
|
338ad6f82c | ||
|
|
c89eb3ccce | ||
|
|
7a38245630 | ||
|
|
6ca16bd0b2 | ||
|
|
70fc97ae38 | ||
|
|
22f8031b91 | ||
|
|
1e121fdddd | ||
|
|
97f4a0ed61 | ||
|
|
277c5e0562 | ||
|
|
fa64af7ff5 | ||
|
|
10bcf9f1f4 | ||
|
|
a75c42f4ac | ||
|
|
f5b81eff4d | ||
|
|
b6bdbee42f | ||
|
|
0fc9fbb79a | ||
|
|
f3c159218a | ||
|
|
e8624cdb1f | ||
|
|
d427989576 | ||
|
|
4706d71639 | ||
|
|
16df893c2c | ||
|
|
6129afd695 | ||
|
|
84504a5931 | ||
|
|
0123f9fa8e | ||
|
|
7227d4e26b | ||
|
|
58fe601b25 | ||
|
|
a61d132b57 | ||
|
|
ee4acfc8e7 | ||
|
|
fcd798a2fa | ||
|
|
f5be0e5842 | ||
|
|
2d9f3abe5d | ||
|
|
69fe737006 | ||
|
|
ac6c9122c2 | ||
|
|
d3e0883332 | ||
|
|
5c39405255 | ||
|
|
6535006d66 | ||
|
|
a43cb91e1e | ||
|
|
58ce807e42 | ||
|
|
2319ae7025 | ||
|
|
1f2058abce | ||
|
|
aadbde330d | ||
|
|
60df07c95c | ||
|
|
71757bb9d5 | ||
|
|
630176d8aa | ||
|
|
03c7f9afe6 | ||
|
|
3c58f90cc9 | ||
|
|
b5261d900f | ||
|
|
9a319eab75 | ||
|
|
aca9cb890d | ||
|
|
c77eb30985 | ||
|
|
6fc842ca37 | ||
|
|
a1ce7aa9fc | ||
|
|
9e3363f22c | ||
|
|
d42d783738 | ||
|
|
5f1a4c8eb6 | ||
|
|
c3494a7f5d | ||
|
|
103b7f2a71 | ||
|
|
c7377e0e06 | ||
|
|
58f521f923 | ||
|
|
4293a958d0 | ||
|
|
4a89fd0aa9 | ||
|
|
f1a3df81b2 | ||
|
|
d876f819fc | ||
|
|
757dc6069e | ||
|
|
e7f4b3fee1 | ||
|
|
319457bada | ||
|
|
c91f5e49c0 | ||
|
|
45e320abe4 | ||
|
|
4d1673ecfb | ||
|
|
3eb3c0854a | ||
|
|
24cf06bf44 | ||
|
|
9318db7762 | ||
|
|
42ca2d1b30 | ||
|
|
446bba67c9 | ||
|
|
c034dfe109 | ||
|
|
129f0a8adb | ||
|
|
a42c7221c6 | ||
|
|
c602fe3ed2 | ||
|
|
33bb74d976 | ||
|
|
422c867c00 | ||
|
|
6e43528802 | ||
|
|
61d4baa181 | ||
|
|
7f451af418 | ||
|
|
b72a1522a4 | ||
|
|
86b1afe243 | ||
|
|
67bf473dda | ||
|
|
5f744fa7bc | ||
|
|
5a8762c7e5 | ||
|
|
b80b067afb | ||
|
|
777b36852f | ||
|
|
dd1cd8db97 | ||
|
|
a1caa78e6e | ||
|
|
4d1e46cbcc | ||
|
|
f59ed85b62 | ||
|
|
ad0c363ae0 | ||
|
|
d8a86f88e1 | ||
|
|
9dd634e8dd | ||
|
|
ba876be76d | ||
|
|
2fa3df7aae | ||
|
|
0d1da36e28 | ||
|
|
c61c8aecc6 | ||
|
|
7a63b26c73 | ||
|
|
0d949b1752 | ||
|
|
33518607c5 | ||
|
|
8a47c02179 | ||
|
|
a1251c065d | ||
|
|
8882e3a03e | ||
|
|
3206d6a632 | ||
|
|
b49a2ee05a | ||
|
|
963b44c8c8 | ||
|
|
f3e60c639f | ||
|
|
c216714c5b | ||
|
|
460ae9a392 | ||
|
|
88c09618ce | ||
|
|
f858d3a848 | ||
|
|
079f93bddb | ||
|
|
0afd5964d4 | ||
|
|
9c76a468aa | ||
|
|
edfb388b9e | ||
|
|
5b07f031be | ||
|
|
d403b4902c | ||
|
|
112bad5d42 | ||
|
|
388cad36be | ||
|
|
091da296c4 | ||
|
|
621eb8245f | ||
|
|
29c78f6012 | ||
|
|
19f8b5221b | ||
|
|
88673c21fe | ||
|
|
051e94fff3 | ||
|
|
ddf16f01d5 | ||
|
|
97dda3e796 | ||
|
|
bc8a707a2d | ||
|
|
28cc6ea501 | ||
|
|
0c4d3fbb60 | ||
|
|
247d64ed82 | ||
|
|
568ff8824f | ||
|
|
3af6573779 | ||
|
|
79a8219883 | ||
|
|
24a12ea68d | ||
|
|
be33ecc2a4 | ||
|
|
72a55b5414 | ||
|
|
a1c9ae8884 | ||
|
|
292f15d3a9 | ||
|
|
5b1a108e61 | ||
|
|
2bc83ab796 | ||
|
|
9248b19db5 | ||
|
|
3a4feb9533 | ||
|
|
b9d9b8f8ca | ||
|
|
8eb300a1a0 | ||
|
|
06d357ad5c | ||
|
|
5fcd576fc7 | ||
|
|
0da51937f7 | ||
|
|
ee58858510 | ||
|
|
451669f4dd | ||
|
|
cb4b25b696 | ||
|
|
daaa2974b8 | ||
|
|
aae403b638 | ||
|
|
e82d7c380f | ||
|
|
74acd1edbc | ||
|
|
022e5aa10c | ||
|
|
a8e5c7cd81 | ||
|
|
573c8bf53d | ||
|
|
54b3b277dc | ||
|
|
87f355ab85 | ||
|
|
80627f3d13 | ||
|
|
03bb19522d | ||
|
|
75d92d3800 | ||
|
|
974ff39c09 | ||
|
|
15ba5f1704 | ||
|
|
3982909801 | ||
|
|
85b5c615b9 | ||
|
|
3227bf38b4 | ||
|
|
ba2fbaa0da | ||
|
|
c12436f464 | ||
|
|
e029d24061 | ||
|
|
ff663b6787 | ||
|
|
5acfe91944 | ||
|
|
7d217e49de | ||
|
|
a67080be61 | ||
|
|
21128d525d | ||
|
|
305905328d | ||
|
|
2e9594274e | ||
|
|
091d5d3c45 | ||
|
|
3a5cf0d3d7 | ||
|
|
ace3c6009a | ||
|
|
807c528086 | ||
|
|
2c22e97dbe | ||
|
|
840866ce06 | ||
|
|
007607e21c | ||
|
|
b4a4a688ca | ||
|
|
688206ef91 | ||
|
|
3acc1bf9c9 | ||
|
|
21b1a9ea81 | ||
|
|
3f252a9b11 | ||
|
|
c5146017a8 | ||
|
|
7f58809737 | ||
|
|
6748390ac4 | ||
|
|
d2fac255ed | ||
|
|
dbcfc46dad | ||
|
|
671719905b | ||
|
|
5417f5d61d | ||
|
|
ee0abc9891 | ||
|
|
bb7407f75f | ||
|
|
b101872906 | ||
|
|
8f42bfa675 | ||
|
|
b8d2008b98 | ||
|
|
36910ab5cf | ||
|
|
ae09f711df | ||
|
|
6401a93420 | ||
|
|
3039c00fdb | ||
|
|
8010765c8e | ||
|
|
62f96dea5e | ||
|
|
15a0177083 | ||
|
|
9f83391e37 | ||
|
|
f742826b8d | ||
|
|
763d7e1309 | ||
|
|
9ae59a1bd7 | ||
|
|
ae64f73c67 | ||
|
|
8329fef6c1 | ||
|
|
0c5aa6895a | ||
|
|
6a770b90b4 | ||
|
|
08a71b3699 | ||
|
|
9c50e5aa36 | ||
|
|
aa20fce137 | ||
|
|
4fc7d54a73 | ||
|
|
7ea8bf70b2 | ||
|
|
8f6bdb27ab | ||
|
|
0487916c7b | ||
|
|
73090f53de | ||
|
|
6ac29a5bbb | ||
|
|
1047a7882a | ||
|
|
09a6585618 | ||
|
|
612615e8ae | ||
|
|
3e66a800b4 | ||
|
|
7f2c5157e5 | ||
|
|
b42289125e | ||
|
|
7b674a610d | ||
|
|
3e410f9e0c | ||
|
|
53cb974446 | ||
|
|
55e65c42a6 | ||
|
|
e389772e87 | ||
|
|
302125b097 | ||
|
|
dbd6b17b03 | ||
|
|
9aa8bc4031 |
No files matched your search
@@ -2,7 +2,7 @@ name: Stats
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 11 * * *"
|
||||
- cron: "0 9 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
||||
@@ -76,6 +76,29 @@
|
||||
"args": "--log-level info --project bsconfig.tests.json --create-package --sourceMap=true --debug --test-mode --lintConfig ../config/bslint.jsonc",
|
||||
"cwd": "${workspaceFolder}/playlet-lib",
|
||||
"console": "integratedTerminal"
|
||||
},
|
||||
{
|
||||
"name": "Playground",
|
||||
"type": "brightscript",
|
||||
"request": "launch",
|
||||
"envFile": "${workspaceFolder}/.env",
|
||||
"host": "${env:ROKU_DEV_TARGET}",
|
||||
"password": "${env:ROKU_DEVPASSWORD}",
|
||||
"stopOnEntry": false,
|
||||
"enableDebuggerAutoRecovery": false,
|
||||
"stopDebuggerOnAppExit": false,
|
||||
"rootDir": "${workspaceFolder}/build/playground",
|
||||
"sourceDirs": [
|
||||
"${workspaceFolder}/playground/src"
|
||||
],
|
||||
"files": [
|
||||
"**"
|
||||
],
|
||||
"preLaunchTask": "build-playground",
|
||||
"injectRdbOnDeviceComponent": true,
|
||||
"injectRaleTrackerTask": true,
|
||||
"raleTrackerTaskFileLocation": "${workspaceFolder}/tools/RALE/TrackerTask.xml",
|
||||
"enableDebugProtocol": true
|
||||
}
|
||||
],
|
||||
"compounds": [
|
||||
|
||||
@@ -8,4 +8,10 @@
|
||||
"editor.formatOnSave": true,
|
||||
"xml.format.maxLineWidth": 0,
|
||||
"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"
|
||||
]
|
||||
}
|
||||
@@ -49,6 +49,11 @@
|
||||
"label": "build-web",
|
||||
"script": "build:web",
|
||||
"type": "npm"
|
||||
},
|
||||
{
|
||||
"label": "build-playground",
|
||||
"script": "build:playground",
|
||||
"type": "npm"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -5,6 +5,395 @@ 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/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.48.0] - 2026-07-01
|
||||
|
||||
### Added
|
||||
|
||||
- Trending back (Gaming and Live) for Playlet backend and Invidious - to avoid a blank home screen when not logged in.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Retry condition issue in http client
|
||||
- Attempt to fix "page needs to be reloaded" edge case
|
||||
- Attempt to reduce errors in post-live DVR videos
|
||||
|
||||
## [0.47.5] - 2026-06-28
|
||||
|
||||
### Fixed
|
||||
|
||||
- Attempt to fix `No valid bitrates` error
|
||||
|
||||
### Removed
|
||||
|
||||
- Play with ytjs option from web app, as it wasn't working anyway
|
||||
|
||||
## [0.47.4] - 2026-06-25
|
||||
|
||||
### Fixed
|
||||
|
||||
- Attempt to fix `MISSING_FORMAT_FIELD` error in live videos
|
||||
- Attempt to fix `No valid bitrates` error
|
||||
|
||||
## [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
|
||||
|
||||
### Added
|
||||
|
||||
- Video player refactored into a new interface, with pause and minimize buttons. This would allow for an easier integration of other features
|
||||
|
||||
### Fixed
|
||||
|
||||
- Live stream videos for Playlet backend, attempt with Invidious
|
||||
- Audio track names when using Invidious
|
||||
- Small leak in video player
|
||||
|
||||
### Changed
|
||||
|
||||
- Pressing down when video is full screen no longer minimizes the video, there's a dedicated button for it now
|
||||
|
||||
## [0.45.0] - 2026-05-25
|
||||
|
||||
### Added
|
||||
|
||||
- Experimental support for changing playback speed from YouTube mobile app using Leanback/Lounge api
|
||||
- Support for disabling AI auto-dubbed audio tracks
|
||||
|
||||
### Fixed
|
||||
|
||||
- Bug where large playlists (1k+ videos) only load the first page
|
||||
|
||||
## [0.44.10] - 2026-05-03
|
||||
|
||||
### Fixed
|
||||
|
||||
- Bug where home screen editor is empty with a fresh install
|
||||
|
||||
## [0.44.9] - 2026-04-25
|
||||
|
||||
### Fixed
|
||||
|
||||
- Updated dependencies and innertube versions
|
||||
|
||||
## [0.44.8] - 2026-04-24
|
||||
|
||||
### Fixed
|
||||
|
||||
- Always use `signatureTimestamp` in `/player` calls to prevent "reload page" errors. This affects watch history.
|
||||
- Attempt 2 to fix watch history and watch progress
|
||||
|
||||
## [0.44.7] - 2026-04-23
|
||||
|
||||
### Fixed
|
||||
|
||||
- Attempt to fix watch history and watch progress
|
||||
- Channel sort
|
||||
|
||||
## [0.44.6] - 2026-02-08
|
||||
|
||||
### Fixed
|
||||
|
||||
- Error dialog doesn't close automatically when playback recovers after an error
|
||||
- All audio track names are shown as "Other" in multi audio track videos
|
||||
|
||||
## [0.44.5] - 2026-01-17
|
||||
|
||||
### Fixed
|
||||
|
||||
- Error handling when ytjs formats have missing urls
|
||||
|
||||
## [0.44.4] - 2025-11-23
|
||||
|
||||
### Fixed
|
||||
|
||||
- Subscriptions looping instead of loading older videos
|
||||
|
||||
### Removed
|
||||
|
||||
- Trending endpoints from code base
|
||||
|
||||
## [0.44.3] - 2025-11-14
|
||||
|
||||
### Fixed
|
||||
|
||||
- Json parsing with invalid chars like `\u0000` preventing some channels from loading
|
||||
|
||||
## [0.44.2] - 2025-11-13
|
||||
|
||||
### Fixed
|
||||
|
||||
- Removed retry on trending feeds
|
||||
|
||||
## [0.44.1] - 2025-11-12
|
||||
|
||||
### Fixed
|
||||
|
||||
- Small change in post-live dvr detection
|
||||
- Issue where recommended videos are all "UPCOMING" paid content
|
||||
- Errors related to loading the trending feeds. Trending will be removed from Playlet in a future release.
|
||||
|
||||
## [0.44.0] - 2025-11-09
|
||||
|
||||
### Added
|
||||
|
||||
- Implemented compactRadioRenderer node
|
||||
- Prioritise manually created subtitles over auto-generated ones
|
||||
|
||||
## [0.43.9] - 2025-11-07
|
||||
|
||||
### Fixed
|
||||
|
||||
- Another mistake in OTF streams
|
||||
|
||||
## [0.43.8] - 2025-11-07
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix in url decipher logic
|
||||
- Redo OTF segment processing
|
||||
|
||||
## [0.43.7] - 2025-11-06
|
||||
|
||||
### Fixed
|
||||
|
||||
- Adjust telemetry for OTF streams to debug
|
||||
|
||||
## [0.43.6] - 2025-11-06
|
||||
|
||||
### Fixed
|
||||
|
||||
- Bug in processing OTF streams info
|
||||
|
||||
## [0.43.5] - 2025-11-06
|
||||
|
||||
### Fixed
|
||||
|
||||
- Post live DVR video support
|
||||
- Attempted OTF stream support
|
||||
- Better parsing of audio track metadata
|
||||
- Bug in detecting live videos in HLS streams
|
||||
|
||||
## [0.43.4] - 2025-11-03
|
||||
|
||||
### Fixed
|
||||
|
||||
- Playback error when regular videos are returned with DRM protection (unless they are OTF)
|
||||
- Fallback to iOS HLS for post dvr and OTF videos
|
||||
|
||||
## [0.43.3] - 2025-10-30
|
||||
|
||||
### Fixed
|
||||
|
||||
- Improve channel parsing in Recommended feed
|
||||
|
||||
## [0.43.2] - 2025-10-29
|
||||
|
||||
### Fixed
|
||||
|
||||
- Crash on older Roku OS version due to `roByteArray.Slice` not being available
|
||||
|
||||
## [0.43.1] - 2025-10-28
|
||||
|
||||
### Added
|
||||
|
||||
- Support for additional nodes parsing
|
||||
|
||||
### Fixed
|
||||
|
||||
- Trickplay storyboards on DRM videos
|
||||
|
||||
## [0.43.0] - 2025-10-26
|
||||
|
||||
### Added
|
||||
|
||||
- Support for DRM protected content (free with ads / purchased content)
|
||||
- Only supported on Playlet backend (must be selected in settings)
|
||||
- Must be logged in using a YouTube account (otherwise you would get a "Login to confirm your age" error)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Build scripts and tools on windows
|
||||
|
||||
## [0.42.5] - 2025-10-21
|
||||
|
||||
### Fixed
|
||||
|
||||
- Crash when trying to display error messages with very long text
|
||||
|
||||
## [0.42.4] - 2025-10-17
|
||||
|
||||
### Added
|
||||
|
||||
- German translations
|
||||
|
||||
### Fixed
|
||||
|
||||
- A bug where title and duration of songs were missing an an album playlist
|
||||
- Error when loading trending videos by retrying to load the feed
|
||||
- Note: trending is removed from web and tv clients, they are being phased out.
|
||||
|
||||
## [0.42.3] - 2025-10-12
|
||||
|
||||
### Fixed
|
||||
|
||||
- Crash when logging early startup warnings
|
||||
|
||||
## [0.42.2] - 2025-10-09
|
||||
|
||||
### Fixed
|
||||
|
||||
- A bug when invalidating tokens
|
||||
- Issue with auto-generated subtitles aligned to the left by using TTML captions
|
||||
- Crash when telemetry thread turned off and then back on
|
||||
|
||||
## [0.42.1] - 2025-10-04
|
||||
|
||||
### Fixed
|
||||
|
||||
- Bug: credentialTransferTokens should only be used with TV clients
|
||||
- [Perf] reduce memory usage by freeing playlist videos when playlist view is closed
|
||||
|
||||
## [0.42.0] - 2025-09-30
|
||||
|
||||
### Added
|
||||
|
||||
- Support for different languages in the search keyboard
|
||||
- Initial list: English, Deutsch, Español, Français, Português and Русский
|
||||
- [More can be added later](https://github.com/iBicha/playlet/issues/362#issuecomment-3352455559).
|
||||
|
||||
## [0.41.21] - 2025-09-28
|
||||
|
||||
### Fixed
|
||||
|
||||
- Dash generation bug
|
||||
- Track login errors and drm errors better
|
||||
|
||||
## [0.41.20] - 2025-09-21
|
||||
|
||||
### Fixed
|
||||
|
||||
- Capturing diagnostic events related to playback errors to further investigate
|
||||
|
||||
## [0.41.19] - 2025-09-21
|
||||
|
||||
### Fixed
|
||||
|
||||
- Capturing diagnostic events related to playback errors to further investigate
|
||||
|
||||
## [0.41.18] - 2025-09-20
|
||||
|
||||
### Fixed
|
||||
|
||||
- Various fixes and improvements
|
||||
- Crash due to bad type casting
|
||||
|
||||
## [0.41.17] - 2025-09-19
|
||||
|
||||
### Fixed
|
||||
|
||||
- Various fixes and improvements
|
||||
|
||||
## [0.41.16] - 2025-09-19
|
||||
|
||||
### Fixed
|
||||
|
||||
- Various fixes and improvements
|
||||
|
||||
## [0.41.15] - 2025-09-19
|
||||
|
||||
### Fixed
|
||||
|
||||
- Rare crash when loading video feed
|
||||
- Improve session data error handling
|
||||
|
||||
## [0.41.14] - 2025-09-18
|
||||
|
||||
### Fixed
|
||||
|
||||
- Try fetching multiple pages in the search, in case results are filtered out (e.g. shorts)
|
||||
- Regression for `Attempt to play the next video when errors occur`
|
||||
- Better handling for lounge lost sessions
|
||||
|
||||
## [0.41.13] - 2025-09-18
|
||||
|
||||
### Fixed
|
||||
|
||||
- Issue with `credentialTransferToken`s which caused "Login to confirm you're not a bot" even when logged in
|
||||
- Adjust live video detection to reduce error rate happening on iOS client (another attempt)
|
||||
- Attempt to play the next video when errors occur
|
||||
- Remove manual video cache for Invidious to avoid stale streams
|
||||
|
||||
## [0.41.12] - 2025-09-17
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fallback to 360p when dash streams are missing
|
||||
|
||||
## [0.41.11] - 2025-09-17
|
||||
|
||||
### Fixed
|
||||
|
||||
- Small fixes related to events
|
||||
|
||||
## [0.41.10] - 2025-09-16
|
||||
|
||||
### Fixed
|
||||
|
||||
- Disabled event batching
|
||||
|
||||
## [0.41.9] - 2025-09-16
|
||||
|
||||
### Added
|
||||
|
||||
- "Open In YouTube" button in web app cast dialog
|
||||
|
||||
### Fixed
|
||||
|
||||
- Bug in dash storyboard
|
||||
- Adjust live video detection to reduce error rate happening on iOS client
|
||||
- Bug when parsing headers in telemetry
|
||||
- Web app fixes and dependency updates
|
||||
- Bug when casting a mix from web app
|
||||
|
||||
## [0.41.8] - 2025-09-07
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -8,6 +8,26 @@ Playlet does not show advertising, whether personalized or non personalized.
|
||||
|
||||
Playlet may integrate with 3rd party telemetry services in order to capture anonymous diagnostics data. The only purpose of this data is to diagnose issues and improve the app.
|
||||
|
||||
### Current telemetry implementation
|
||||
|
||||
> This section tries to explain in more detail what data is collected and how it is used. Due to the granularity and details of the following explanation, it might be slightly out of date, but mostly represents the reality of the "Playlet may integrate with 3rd party telemetry services"
|
||||
|
||||
Currently, Playlet captures a bunch of errors through the [telemetry client code](https://github.com/iBicha/playlet/tree/f3c159218ac8e3eec08eb7b62cbd45ad6c451b99/playlet-lib/src/components/Telemetry).
|
||||
It's mostly OS info (version, device model, etc), app info, user country code, locale, error messages, and stack traces. Nothing more than necessary is captured to debug problems.
|
||||
|
||||
In addition to that, an anonymous user id (just a guid stable across app launches of Playlet) and a session id (generated on every launch) are collected.
|
||||
|
||||
The user id is used to understand how many people an error affects. Sometimes one issue is spread out evenly among users, sometimes it's a handful of users (or even just one) spamming the same errors. This helps investigate that aspect.
|
||||
|
||||
The session id is used to understand how an error happened. By isolating a specific error to a session, it helps understand what led to said error.
|
||||
|
||||
This data is currently sent to a server, then forwarded to a self-hosted instance [Glitch-Tip](https://gitlab.com/glitchtip/glitchtip) which provides a simple dashboard showing how frequent errors are, and on which versions they occur.
|
||||
|
||||
This data is anonymous. The data is not collected in a way that can be linked back to a real person, or a YouTube profile for example.
|
||||
The data is stored on a local hard drive, does not leave said hard drive, and accessed only by the currently single developer of Playlet, and frequently purged (because honestly I don't have the disk space).
|
||||
|
||||
The data is used to investigate errors, like playback errors, feed load errors, login errors, and so on.
|
||||
|
||||
## Invidious
|
||||
|
||||
Playlet may request information from one or more [Invidious](https://invidious.io/)
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
|
||||
Playlet is an unofficial YouTube client for Roku 📺
|
||||
|
||||
**[Playlet February 2026 Update](https://github.com/iBicha/playlet/discussions/827)**
|
||||
|
||||
|
||||
## Screenshots
|
||||
|
||||
<a href="./docs/screenshots/README.md">
|
||||
@@ -63,22 +66,6 @@ Can't install from the store? See [How to install Playlet as a sideloaded/dev ap
|
||||
- Use the YouTube app to connect using the same Wi-Fi; OR
|
||||
- Use the `Link with TV code` to connect
|
||||
|
||||
### Picture-in-picture
|
||||
|
||||
- When viewing a video in full screen, press ⬇️ (down) button on your remote to shrink the video
|
||||
- You can browse or search for videos while you watch
|
||||
- To restore currently playing video to full screen, press the ✳️ (options) button
|
||||
|
||||
### Customize Invidious instance
|
||||
|
||||
1. Open settings in Playlet
|
||||
1. Select Invidious -> Instance
|
||||
1. Set a custom instance, or choose a public one hosted by volunteers (from [api.invidious.io](https://api.invidious.io/))
|
||||
1. Optionally, Select `Test instance` to make sure it works
|
||||
1. Hit save
|
||||
|
||||
> ℹ️ **Note**: If you are logged in when you change the instance, you will remain logged in to the old instance. In this case, Playlet will use the old instance to retrieve your subscriptions and your playlists, but will use the new instance for everything else. After switching to a new instance, you can log out and log in again to use your profile on the new instance.
|
||||
|
||||
## Development
|
||||
|
||||
For everything related to Playlet app development, please see the [documentation](./docs/README.md)
|
||||
|
||||
@@ -58,6 +58,12 @@
|
||||
"regex": "\\bTr\\s*\\(\\s*\"[^\\\"]*\"\\s*\\)",
|
||||
"regexFlags": "ig",
|
||||
"message": "Tr(\"String\") is not allowed. Use Tr(Locale.Key) instead."
|
||||
},
|
||||
{
|
||||
"code": "NO_PARSE_JSON",
|
||||
"regex": "\\s*ParseJson\\(",
|
||||
"regexFlags": "ig",
|
||||
"message": "ParseJson is not allowed. Use StringUtils.ParseJsonSafe() instead."
|
||||
}
|
||||
],
|
||||
"files": [
|
||||
@@ -69,13 +75,12 @@
|
||||
"!**/*.svg",
|
||||
"!**/*.svg.meta.json5",
|
||||
"!**/*.proto",
|
||||
"!**/*.md",
|
||||
"locale/**",
|
||||
"config/**",
|
||||
"lib/**",
|
||||
"www/**",
|
||||
"manifest",
|
||||
"!**/*.transpiled/**",
|
||||
"!**/*.transpiled.*",
|
||||
"!**/*.spec.bs",
|
||||
"!**/tests/**"
|
||||
],
|
||||
@@ -84,17 +89,18 @@
|
||||
"@rokucommunity/bslint",
|
||||
"../tools/bs-plugins/jobsystem-plugin.ts",
|
||||
"../tools/bs-plugins/manifest-edit-plugin.ts",
|
||||
"../tools/bs-plugins/odc-plugin.ts",
|
||||
"../tools/bs-plugins/component-includes-plugin.ts",
|
||||
"../tools/bs-plugins/bindings-plugin.ts",
|
||||
"../tools/bs-plugins/oninit-plugin.ts",
|
||||
"../tools/bs-plugins/track-transpiled-plugin.ts",
|
||||
"../tools/bs-plugins/json-yaml-plugin.ts",
|
||||
"../tools/bs-plugins/validation-plugin.ts",
|
||||
"../tools/bs-plugins/logger-plugin.ts",
|
||||
"../tools/bs-plugins/type-gen-plugin.ts",
|
||||
"../tools/bs-plugins/web-server-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,
|
||||
"require": [
|
||||
|
||||
@@ -13,9 +13,7 @@
|
||||
"config/**",
|
||||
"lib/**",
|
||||
"www/**",
|
||||
"manifest",
|
||||
"!**/*.transpiled/**",
|
||||
"!**/*.transpiled.*"
|
||||
"manifest"
|
||||
],
|
||||
"plugins": [
|
||||
"@rokucommunity/bslint",
|
||||
@@ -25,14 +23,14 @@
|
||||
"../tools/bs-plugins/component-includes-plugin.ts",
|
||||
"../tools/bs-plugins/bindings-plugin.ts",
|
||||
"../tools/bs-plugins/oninit-plugin.ts",
|
||||
"../tools/bs-plugins/track-transpiled-plugin.ts",
|
||||
"../tools/bs-plugins/json-yaml-plugin.ts",
|
||||
"../tools/bs-plugins/validation-plugin.ts",
|
||||
"../tools/bs-plugins/logger-plugin.ts",
|
||||
"../tools/bs-plugins/type-gen-plugin.ts",
|
||||
"../tools/bs-plugins/web-server-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": {
|
||||
"logLevel": 2,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"globals": [],
|
||||
"ignores": [
|
||||
"**/roku_modules/**/*",
|
||||
"**/components/rooibos/**/*",
|
||||
"**/bslib.brs"
|
||||
],
|
||||
"rules": {
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
- [@oninit](#oninit)
|
||||
- [Bindings](#bindings)
|
||||
- [Job System Generator](#job-system-generator)
|
||||
- [Tracking transpilied files](#tracking-transpilied-files)
|
||||
- [Logger](#logger)
|
||||
- [Type Gen](#type-gen)
|
||||
- [Web Server](#web-server)
|
||||
- [Locale validation](#locale-validation)
|
||||
- [Protobuf Generator](#protobuf-generator)
|
||||
@@ -448,8 +446,9 @@ function ExecuteJob() as void
|
||||
' input is an associative array set when the job is queued.
|
||||
input = JobGetInput()
|
||||
|
||||
value = DoWork(myVar)
|
||||
value = DoWork(input.myVar)
|
||||
|
||||
' optional
|
||||
JobSuccessData({result: value})
|
||||
end function
|
||||
```
|
||||
@@ -469,27 +468,6 @@ The job system will auto scale up to a maximum number of tasks, in order to avoi
|
||||
|
||||
Although very useful, this pattern might not be the best for long running tasks (like the Web Server) and it is simpler to create dedicated tasks for those.
|
||||
|
||||
## Tracking transpilied files
|
||||
|
||||
**[Source](/tools/bs-plugins/track-transpiled-plugin.ts)**
|
||||
|
||||
By now, you realize we make a lot of transformations to the source code through many plugins. As a sanity check, this plugin allows us to keep track of the transpiled files, so we can be sure that the output is what we expect.
|
||||
|
||||
### Why
|
||||
|
||||
This is useful to catch errors with the plugin usage, of bugs with the plugins themselves.
|
||||
|
||||
### How
|
||||
|
||||
When transpiling a file, say `MyComponent.xml`, the plugin will see if there is a `MyComponent.transpiled.xml` right next to it in the source.
|
||||
If a file is found, then the transpiled file of `MyComponent.xml` will be copied back from the staging folder to `MyComponent.transpiled.xml`.
|
||||
|
||||
Additionally, if there's a folder `MyFolder` and `MyFolder.transpiled` in the source, then all transpiled files of `MyFolder` will also be copied back to `MyFolder.transpiled`. Keeping track of entire folders is primarily to track of transpiled files of test nodes and scripts.
|
||||
|
||||
To reduce the noise of this plugin, it only runs when we're making a test build.
|
||||
|
||||
Because we continiously make test build in Github actions, the tracked transpilied files will be automatically added to PRs, so that we notice if outputs do not look right.
|
||||
|
||||
## Logger
|
||||
|
||||
**[Source](/tools/bs-plugins/logger-plugin.ts)**
|
||||
@@ -527,36 +505,6 @@ To understand more about what's being generated, download `playlet-lib.zip` from
|
||||
|
||||
To give credit where credit is due, some of the ideas here (like adding the source location to the log) came from [roku-log](https://github.com/georgejecook/roku-log)
|
||||
|
||||
## Type Gen
|
||||
|
||||
**[Source](/tools/bs-plugins/type-gen-plugin.ts)**
|
||||
|
||||
### Why
|
||||
|
||||
I found myself implementing type checking functions like `IsBool`, `IsInt`, and `IsString`, and functions for getting a valid type, like `ValidBool`, `ValidInt`, and `ValidString`. The implementation is the same, why not generate them?
|
||||
|
||||
### How
|
||||
|
||||
Simply we declare them in an object describing the type, the interface, and the default value, and generate all corresponding functions.
|
||||
|
||||
Sample output:
|
||||
|
||||
```brs
|
||||
' Returns true if the given object is of type Bool, false otherwise
|
||||
function IsBool(obj as dynamic) as boolean
|
||||
return obj <> invalid and GetInterface(obj, "ifBoolean") <> invalid
|
||||
end function
|
||||
|
||||
' Returns the given object if it is of type Bool, otherwise returns the default value `false`
|
||||
function ValidBool(obj as dynamic) as boolean
|
||||
if obj <> invalid and GetInterface(obj, "ifBoolean") <> invalid
|
||||
return obj
|
||||
else
|
||||
return false
|
||||
end if
|
||||
end function
|
||||
```
|
||||
|
||||
## Web Server
|
||||
|
||||
**[Source](/tools/bs-plugins/web-server-plugin.ts)**
|
||||
|
||||
@@ -30,19 +30,17 @@ export function setupEnvironment(appId = AppId.DEV) {
|
||||
})
|
||||
}
|
||||
|
||||
function getEnvVars(requiredVars = undefined) {
|
||||
let envVars = process.env;
|
||||
function getEnvVars(requiredVars: string[] = []): Record<string, string> {
|
||||
let envVars: Record<string, string | undefined> = { ...process.env };
|
||||
if (fs.existsSync(envFile)) {
|
||||
const envConfig = dotenv.parse(fs.readFileSync(envFile));
|
||||
envVars = { ...envVars, ...envConfig };
|
||||
}
|
||||
if (requiredVars) {
|
||||
const missingVars = requiredVars.filter((key) => !envVars[key]);
|
||||
if (missingVars.length) {
|
||||
throw new Error(`Missing environment variables: ${missingVars.join(', ')}`);
|
||||
}
|
||||
const missingVars = requiredVars.filter((key) => !envVars[key]);
|
||||
if (missingVars.length) {
|
||||
throw new Error(`Missing environment variables: ${missingVars.join(', ')}`);
|
||||
}
|
||||
|
||||
return envVars;
|
||||
// every required var is validated present above; absent optional keys are simply not read.
|
||||
return envVars as Record<string, string>;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
// Find a CURRENTLY-LIVE YouTube video id via youtubei.js (Innertube.search), so the live e2e spec doesn't depend
|
||||
// on a single hardcoded stream that can go offline. Cached to tmp/ for ~15 min (one test session) so repeated
|
||||
// runs don't re-search. Returns undefined on any failure — the caller falls back to a hardcoded id, then skips.
|
||||
import { Innertube } from 'youtubei.js';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const CACHE = `${__dirname}/../tmp/live-id.cache`;
|
||||
const TTL_MS = 15 * 60 * 1000;
|
||||
|
||||
export async function getLiveVideoId(query = 'lofi hip hop radio'): Promise<string | undefined> {
|
||||
// session cache (by file mtime): a live id stays valid for a while; re-search past the TTL.
|
||||
try {
|
||||
if (Date.now() - fs.statSync(CACHE).mtimeMs < TTL_MS) {
|
||||
const cached = fs.readFileSync(CACHE, 'utf8').trim();
|
||||
if (cached) { console.log(`live-id: using cached ${cached}`); return cached; }
|
||||
}
|
||||
} catch { /* no/stale cache */ }
|
||||
|
||||
try {
|
||||
const yt = await Innertube.create({ retrieve_player: false });
|
||||
// SOURCE-side filter: features:['live'] asks YouTube for live videos only (don't rely on post-filtering a
|
||||
// general search, which could return a VOD titled like a live stream). is_live below is belt-and-suspenders.
|
||||
const search = await yt.search(query, { type: 'video', features: ['live'] });
|
||||
const items: any[] = (search as any).videos ?? (search as any).results ?? [];
|
||||
const isLive = (v: any) =>
|
||||
v?.is_live === true ||
|
||||
v?.is_live_content === true ||
|
||||
(Array.isArray(v?.badges) && v.badges.some((b: any) => /live/i.test(b?.label ?? b?.style ?? '')));
|
||||
const cand = items.filter((v) => v && (v.id || v.video_id));
|
||||
const pick = cand.find(isLive) ?? cand[0];
|
||||
const id: string | undefined = pick?.id ?? pick?.video_id;
|
||||
if (id) {
|
||||
try { fs.mkdirSync(`${__dirname}/../tmp`, { recursive: true }); fs.writeFileSync(CACHE, id); } catch { /* */ }
|
||||
const title = pick?.title?.text ?? pick?.title ?? '';
|
||||
console.log(`live-id: found ${id} live=${isLive(pick)} "${title}"`);
|
||||
return id;
|
||||
}
|
||||
console.log('live-id: search returned no usable video');
|
||||
} catch (e) {
|
||||
console.log(`live-id: search failed (${e}) — caller will fall back`);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
// VideoPlayerDev adversarial e2e: drive rapid / edge-case transport sequences and assert the device-seam
|
||||
// invariants after EVERY input (pressChecked) — a transport never leaves the video "playing", and the bif is up
|
||||
// iff a transport is active. The broad regression net for "impossible states".
|
||||
//
|
||||
// cd references/playlet-legacy && npx tsx ./integration-tests/vpd-player-adversarial.ts
|
||||
|
||||
import { Key, odc, launchVod, finish, group, pressChecked, assertPlayerInvariants } from './vpd-player-harness';
|
||||
|
||||
const CONTENT_ID = 'aqz-KE-bpKQ'; // Big Buck Bunny — 10min, has storyboards
|
||||
|
||||
(async () => {
|
||||
await launchVod(CONTENT_ID);
|
||||
await assertPlayerInvariants('resting');
|
||||
|
||||
group('self-heal guard fires: force an out-of-band resume under a transport');
|
||||
await pressChecked(Key.Left, 'scrub-for-guard');
|
||||
// Force the Video to PLAY while the brain is still scrubbing (the out-of-band auto-resume a SponsorBlock seek
|
||||
// causes). The guard MUST catch it and re-pause; assertPlayerInvariants polls ~2.5s, so this passes only if it did.
|
||||
await odc.setValue({ base: 'scene', keyPath: '#VideoPlayer.control', value: 'resume' });
|
||||
await assertPlayerInvariants('guard re-freezes a resume-under-scrub');
|
||||
await pressChecked(Key.Ok, 'commit-after-guard');
|
||||
|
||||
group('reveal, then rapid scrub<->scan mode flips');
|
||||
await pressChecked(Key.Ok, 'reveal');
|
||||
await pressChecked(Key.Left, 'scrub');
|
||||
await pressChecked(Key.Rewind, 'scrub->scan-rev');
|
||||
await pressChecked(Key.Forward, 'scan-flip-fwd');
|
||||
await pressChecked(Key.Left, 'scan->scrub');
|
||||
await pressChecked(Key.Ok, 'commit');
|
||||
|
||||
group('commit then immediate re-scrub (the bug-pattern shape, minus SponsorBlock)');
|
||||
await pressChecked(Key.Left, 'scrub2');
|
||||
await pressChecked(Key.Ok, 'commit2');
|
||||
await pressChecked(Key.Left, 'rescrub-right-after-commit');
|
||||
await pressChecked(Key.Right, 'scrub-step');
|
||||
await pressChecked(Key.Ok, 'commit3');
|
||||
|
||||
group('replay spam from idle + from a transport');
|
||||
await pressChecked(Key.Replay, 'replay1');
|
||||
await pressChecked(Key.Replay, 'replay2');
|
||||
await pressChecked(Key.Left, 'scrub-after-replay');
|
||||
await pressChecked(Key.Replay, 'replay-from-scrub');
|
||||
await pressChecked(Key.Ok, 'settle');
|
||||
|
||||
group('double-OK + scan-to-scrub');
|
||||
await pressChecked(Key.Rewind, 'scan');
|
||||
await pressChecked(Key.Ok, 'commit-scan');
|
||||
await pressChecked(Key.Ok, 'second-ok-idle');
|
||||
await pressChecked(Key.Forward, 'scan2');
|
||||
await pressChecked(Key.Left, 'scan-to-scrub');
|
||||
await pressChecked(Key.Ok, 'final-commit');
|
||||
|
||||
group('two-tier focus: buttons <-> bar, scrub from the bar');
|
||||
await pressChecked(Key.Ok, 'reveal-buttons-focus');
|
||||
await pressChecked(Key.Down, 'focus-bar');
|
||||
await pressChecked(Key.Up, 'focus-buttons');
|
||||
await pressChecked(Key.Down, 'focus-bar-2');
|
||||
await pressChecked(Key.Left, 'scrub-from-bar');
|
||||
await pressChecked(Key.Ok, 'commit-from-bar');
|
||||
|
||||
await finish();
|
||||
})();
|
||||
@@ -0,0 +1,45 @@
|
||||
// VideoPlayerDev scrub-filmstrip (BifDisplay) e2e: enter scrub on a clip with storyboards and assert the center
|
||||
// thumbnail tile actually LOADED the right image — not just that the strip is visible (guards a blank/wrong-tile
|
||||
// regression a `#bifDisplay.visible` check would miss).
|
||||
//
|
||||
// cd references/playlet-legacy && npx tsx ./integration-tests/vpd-player-bif.ts
|
||||
// PLAYER_BIF_ID=<id> npx tsx ./integration-tests/vpd-player-bif.ts # override the clip
|
||||
//
|
||||
// The tile texture's `loadStatus == "ready"` is the real load signal — `loadWidth` reads 0 even when loaded.
|
||||
|
||||
import { Key, Mode, press, launchVod, finish, group, field, expectField, expectPred, check, waitFor } from './vpd-player-harness';
|
||||
|
||||
const BIF_ID = process.env.PLAYER_BIF_ID || 'aqz-KE-bpKQ'; // Big Buck Bunny (Blender) — 10min, has storyboards
|
||||
|
||||
interface TileSet {
|
||||
htiles?: number;
|
||||
vtiles?: number;
|
||||
duration?: number;
|
||||
final_time?: number;
|
||||
}
|
||||
|
||||
(async () => {
|
||||
await launchVod(BIF_ID);
|
||||
|
||||
group('scrub shows a filmstrip with a real, loaded center tile');
|
||||
await press(Key.Left);
|
||||
await waitFor('#bifDisplay.transportMode', (v) => v === Mode.scrub, 'scrub engaged before stepping');
|
||||
await press(Key.Right); // step the cursor into the storyboard range
|
||||
await expectField('#bifDisplay.transportMode', Mode.scrub);
|
||||
await expectField('#bifDisplay.visible', true);
|
||||
|
||||
const ts = await field<TileSet>('#bifDisplay.tileSet');
|
||||
check('native tile-set present (grid > 0)', !!ts && (ts.htiles ?? 0) > 0 && (ts.vtiles ?? 0) > 0, { grid: `${ts?.htiles}x${ts?.vtiles}`, duration: ts?.duration });
|
||||
|
||||
const uri = await field<string>('#bifTileC.uri');
|
||||
check('center tile uri is an http(s) storyboard url', typeof uri === 'string' && /^https?:\/\//.test(uri), uri);
|
||||
|
||||
await expectPred('#bifTileC.loadStatus', (v) => v === 'ready', 'center tile texture loaded', 6000);
|
||||
|
||||
group('commit returns to idle and the strip self-hides');
|
||||
await press(Key.Ok);
|
||||
await expectField('#bifDisplay.transportMode', Mode.idle);
|
||||
await expectField('#bifDisplay.visible', false);
|
||||
|
||||
await finish();
|
||||
})();
|
||||
@@ -0,0 +1,69 @@
|
||||
// VideoPlayerDev two-tier focus e2e: on reveal, play/pause is focused by default; Down moves focus to the
|
||||
// trackbar (its cursor grows), Up returns to the buttons, Left/Right move between buttons.
|
||||
//
|
||||
// cd references/playlet-legacy && npx tsx ./integration-tests/vpd-player-buttonrow.ts
|
||||
|
||||
import { Key, Button, Mode, press, launchVod, finish, group, expectField, expectPred, expectMediaState, waitFor } from './vpd-player-harness';
|
||||
|
||||
const CONTENT_ID = 'jNQXAC9IVRw'; // "Me at the zoo"
|
||||
|
||||
(async () => {
|
||||
await launchVod(CONTENT_ID);
|
||||
|
||||
group('OK reveals chrome -> play/pause focused by default (two-tier focus)');
|
||||
await press(Key.Ok);
|
||||
await expectField('#buttonRow.visible', true);
|
||||
await expectField('#buttonRow.transportMode', Mode.idle);
|
||||
await expectField('#buttonRow.rowFocused', true);
|
||||
await expectField('#buttonRow.focusedIndex', Button.playPause);
|
||||
await expectField('#PlayPauseButton.focused', true);
|
||||
await expectField('#trickPlayBar.focused', false);
|
||||
|
||||
group('Right/Left move between buttons (clamped)');
|
||||
await press(Key.Right);
|
||||
await expectField('#buttonRow.focusedIndex', Button.minimize);
|
||||
await expectField('#MinimizeButton.focused', true);
|
||||
await expectField('#PlayPauseButton.focused', false);
|
||||
await press(Key.Right);
|
||||
await expectField('#buttonRow.focusedIndex', Button.minimize); // clamp, no wrap
|
||||
await press(Key.Left);
|
||||
await expectField('#buttonRow.focusedIndex', Button.playPause);
|
||||
|
||||
group('Down -> focus the bar (cursor grows); Up -> back to play/pause');
|
||||
await press(Key.Down);
|
||||
await expectField('#buttonRow.rowFocused', false);
|
||||
await expectField('#trickPlayBar.focused', true);
|
||||
await expectField('#VideoPlayer.state', 'playing'); // Down no longer minimizes — playback untouched
|
||||
await press(Key.Up);
|
||||
await expectField('#buttonRow.rowFocused', true);
|
||||
await expectField('#buttonRow.focusedIndex', Button.playPause);
|
||||
await expectField('#trickPlayBar.focused', false);
|
||||
|
||||
group('activate play/pause -> pauses (icon flips to play)');
|
||||
await press(Key.Ok);
|
||||
await expectMediaState('pause');
|
||||
await expectField('#VideoPlayer.state', 'paused');
|
||||
await expectField('#buttonRow.playing', false);
|
||||
await expectField('#PlayPauseButton.toggleState', true);
|
||||
await expectField('#buttonRow.rowFocused', true); // activating a button keeps focus on the buttons
|
||||
|
||||
group('OK on play/pause resumes + hides chrome + drops focus');
|
||||
await press(Key.Ok);
|
||||
await expectMediaState('play');
|
||||
await expectField('#VideoPlayer.state', 'playing');
|
||||
await expectField('#buttonRow.rowFocused', false);
|
||||
await expectField('#Chrome.opacity', 0);
|
||||
|
||||
// LAST: minimize is the only path now (Down doesn't), and PiP teardown stays at the end so it can't bleed.
|
||||
group('activate the minimize button -> the player minimizes to PiP');
|
||||
await press(Key.Ok);
|
||||
await waitFor('#buttonRow.rowFocused', (v) => v === true, 'buttons focused on reveal');
|
||||
await press(Key.Right);
|
||||
await expectField('#buttonRow.focusedIndex', Button.minimize);
|
||||
await press(Key.Ok); // activate -> PiP shrink (width 1280 -> 426, ~0.3s)
|
||||
await expectPred('#VideoPlayer.width', (w) => w > 0 && w < 1000, 'player shrank to the PiP window');
|
||||
await expectField('#Chrome.opacity', 0);
|
||||
await expectField('#buttonRow.rowFocused', false);
|
||||
|
||||
await finish();
|
||||
})();
|
||||
@@ -0,0 +1,245 @@
|
||||
// Shared helpers for the VideoPlayerDev on-device e2e specs: each spec deep-links a video, drives the device
|
||||
// over rta ecp/odc, asserts on ODC field reads, and exits non-zero on failure.
|
||||
//
|
||||
// Read `#Chrome.opacity` (1 shown / 0 hidden), not `.visible` — visible stays true mid-fade-out. Read
|
||||
// `#spinner.mode` (0 none / 1 loading / 2 buffering), not `#spinner.visible` — that id collides with the inner
|
||||
// BusySpinner and the Group's visible is always true.
|
||||
|
||||
import { ecp, odc } from 'roku-test-automation';
|
||||
import { AppId, setupEnvironment } from './common';
|
||||
import { Key } from 'roku-test-automation/client/dist/ECP';
|
||||
|
||||
export { Key, ecp, odc };
|
||||
|
||||
// Mirror the BrightScript enums the renderers project.
|
||||
export const Mode = { idle: 0, scrub: 1, scan: 2, liveDvr: 3 } as const;
|
||||
export const Glyph = { none: 0, replay: 9 } as const;
|
||||
export const Button = { playPause: 0, minimize: 1 } as const;
|
||||
|
||||
const j = (v: unknown) => JSON.stringify(v);
|
||||
const eq = (a: unknown, b: unknown) => j(a) === j(b);
|
||||
|
||||
let failures: string[] = [];
|
||||
let soft: string[] = [];
|
||||
let section = '';
|
||||
|
||||
export function group(name: string): void {
|
||||
section = name;
|
||||
console.log(`\n── ${name} ──`);
|
||||
}
|
||||
|
||||
function record(ok: boolean, msg: string, isSoft = false): void {
|
||||
console.log(` ${ok ? '✓' : isSoft ? '⚠ soft' : '✗ FAIL'} ${msg}`);
|
||||
if (!ok) (isSoft ? soft : failures).push(`[${section}] ${msg}`);
|
||||
}
|
||||
|
||||
export async function field<T = unknown>(keyPath: string): Promise<T | undefined> {
|
||||
const res = await odc.getValue({ base: 'scene', keyPath });
|
||||
return res?.value as T | undefined;
|
||||
}
|
||||
|
||||
// The player retries a failed stream URL once, so a single transient state="error" is expected to recover. A
|
||||
// second episode, or one that never clears within 8s, is an unrecovered failure — abort the suite.
|
||||
let errorEpisodes = 0, inError = false, firstErrorAt = 0;
|
||||
async function fatalErrorTripwire(): Promise<void> {
|
||||
let st: string | undefined;
|
||||
try { st = await field<string>('#VideoPlayer.state'); } catch { return; }
|
||||
if (st === 'error') {
|
||||
if (!inError) { inError = true; errorEpisodes++; firstErrorAt = Date.now(); }
|
||||
if (errorEpisodes >= 2 || Date.now() - firstErrorAt > 8000) {
|
||||
throw new Error(`FATAL: unrecovered video error (episodes=${errorEpisodes}) — the player's one retry did not recover (e.g. 403 with no working stream URL). Aborting the suite.`);
|
||||
}
|
||||
} else {
|
||||
inError = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function settle(keyPath: string, pred: (v: unknown) => boolean, timeoutMs: number): Promise<unknown> {
|
||||
const start = Date.now();
|
||||
let v = await field(keyPath);
|
||||
while (!pred(v) && Date.now() - start < timeoutMs) {
|
||||
await fatalErrorTripwire();
|
||||
await ecp.sleep(120);
|
||||
v = await field(keyPath);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
export async function expectField(keyPath: string, expected: unknown, timeoutMs = 4000): Promise<void> {
|
||||
const got = await settle(keyPath, (v) => eq(v, expected), timeoutMs);
|
||||
record(eq(got, expected), `${keyPath} = ${j(got)}${eq(got, expected) ? '' : ` (expected ${j(expected)})`}`);
|
||||
}
|
||||
|
||||
export async function expectPred(keyPath: string, pred: (v: any) => boolean, descr: string, timeoutMs = 4000): Promise<void> {
|
||||
const got = await settle(keyPath, pred, timeoutMs);
|
||||
record(pred(got), `${keyPath} ${descr} (got ${j(got)})`);
|
||||
}
|
||||
|
||||
// Soft variant: a miss is a warning, not a failure — for racy signals (the ~700ms replay glyph) and
|
||||
// live-stream-dependent checks.
|
||||
export async function expectSoft(keyPath: string, pred: (v: any) => boolean, descr: string, timeoutMs = 1500): Promise<void> {
|
||||
const got = await settle(keyPath, pred, timeoutMs);
|
||||
record(pred(got), `${keyPath} ${descr} (got ${j(got)})`, true);
|
||||
}
|
||||
|
||||
export async function expectMediaState(expected: string, timeoutMs = 8000): Promise<void> {
|
||||
const start = Date.now();
|
||||
let last: string | undefined;
|
||||
while (Date.now() - start < timeoutMs) {
|
||||
last = (await ecp.getMediaPlayer()).state;
|
||||
if (last === expected) break;
|
||||
await ecp.sleep(250);
|
||||
}
|
||||
record(last === expected, `ecp media state = ${last}${last === expected ? '' : ` (expected ${expected})`}`);
|
||||
}
|
||||
|
||||
export function check(label: string, ok: boolean, detail?: unknown): void {
|
||||
record(ok, `${label}${detail === undefined ? '' : ` (${typeof detail === 'string' ? detail : j(detail)})`}`);
|
||||
}
|
||||
|
||||
export async function press(key: Key): Promise<void> {
|
||||
await ecp.sendKeypress(key);
|
||||
}
|
||||
|
||||
// A fixed wait for a visual transition with no field oracle — named so it's auditable. Prefer waitFor().
|
||||
export async function frames(ms = 200): Promise<void> {
|
||||
await ecp.sleep(ms);
|
||||
}
|
||||
|
||||
export async function waitFor(keyPath: string, pred: (v: any) => boolean, descr: string, timeoutMs = 4000): Promise<void> {
|
||||
const got = await settle(keyPath, pred, timeoutMs);
|
||||
record(pred(got), `waitFor ${keyPath} ${descr} (got ${j(got)})`);
|
||||
}
|
||||
|
||||
// Device-seam invariants read from the live node tree. Polls briefly so the self-heal guard (re-pauses on the
|
||||
// next position tick) and chrome fades settle — assert the steady state, not a mid-transition blip.
|
||||
export async function assertPlayerInvariants(label: string): Promise<void> {
|
||||
const inTransport = (m: number | undefined) => m === Mode.scrub || m === Mode.scan || m === Mode.liveDvr;
|
||||
let mode = await field<number>('#trickPlayBar.transportMode');
|
||||
let state = await field<string>('#VideoPlayer.state');
|
||||
const start = Date.now();
|
||||
while (inTransport(mode) && state === 'playing' && Date.now() - start < 2500) {
|
||||
await ecp.sleep(200);
|
||||
mode = await field<number>('#trickPlayBar.transportMode');
|
||||
state = await field<string>('#VideoPlayer.state');
|
||||
}
|
||||
const bif = await field<boolean>('#bifDisplay.visible');
|
||||
// a transport freezes the video (never "playing" under one); the bif is visible iff a transport is active.
|
||||
check(`INV-D1 @ ${label}`, !(inTransport(mode) && state === 'playing'), `mode=${mode} state=${state}`);
|
||||
check(`INV-D2 @ ${label}`, bif === inTransport(mode), `bif=${bif} mode=${mode}`);
|
||||
// the button row is visible iff idle (it rides the Chrome group's fade for actual paint).
|
||||
const rowVisible = await field<boolean>('#buttonRow.visible');
|
||||
check(`INV-D3 @ ${label}`, rowVisible === (mode === Mode.idle), `rowVisible=${rowVisible} mode=${mode}`);
|
||||
const rowFocused = await field<boolean>('#buttonRow.rowFocused');
|
||||
const opacity = await field<number>('#Chrome.opacity');
|
||||
// the button row is focusable only at idle; nothing is focused while the chrome is hidden.
|
||||
check(`INV-D4 @ ${label}`, !rowFocused || mode === Mode.idle, `rowFocused=${rowFocused} mode=${mode}`);
|
||||
check(`INV-D5 @ ${label}`, opacity !== 0 || !rowFocused, `opacity=${opacity} rowFocused=${rowFocused}`);
|
||||
}
|
||||
|
||||
// press + assert the whole invariant set (rapid adversarial sequences have no single per-key oracle). The paced
|
||||
// wait lets the deferred freeze land after a commit-seek settles before the strict check.
|
||||
export async function pressChecked(key: Key, label: string): Promise<void> {
|
||||
await press(key);
|
||||
await frames(600);
|
||||
await assertPlayerInvariants(label);
|
||||
}
|
||||
|
||||
// Hard-fail if #VideoPlayer is the stock player, not VideoPlayerDev (chosen at compile time by USE_DEV_PLAYER),
|
||||
// so a wrong-build run can't masquerade as a pass.
|
||||
export async function assertPlayerIsDev(): Promise<void> {
|
||||
const isDev = await odc.isSubtype({ base: 'scene', keyPath: '#VideoPlayer', subtype: 'VideoPlayerDev' });
|
||||
if (!isDev) {
|
||||
console.log('\nFAILED: #VideoPlayer is not a VideoPlayerDev. Build the lib with `#const USE_DEV_PLAYER = true` (VideoQueue.bs) before running the player suite.');
|
||||
await ecp.sendKeypress(Key.Home);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(' player node subtype: VideoPlayerDev ✓');
|
||||
}
|
||||
|
||||
// Hard-fail unless the device's EFFECTIVE SponsorBlock config matches the sbskip fixture: enabled +
|
||||
// notifications + outro=manual_skip (the shipped defaults from config/preferences.json5; user_prefs overrides
|
||||
// them). With SponsorBlock off the sbskip spec would exercise a plain OK/Right from idle and pass vacuously.
|
||||
export async function assertSponsorBlockFixture(): Promise<void> {
|
||||
let prefs: Record<string, any> = {};
|
||||
try {
|
||||
const { values } = await odc.readRegistry({});
|
||||
prefs = JSON.parse((values as any)?.Playlet?.user_prefs ?? '{}');
|
||||
} catch {
|
||||
/* no overrides -> the defaults apply */
|
||||
}
|
||||
const enabled = prefs['sponsorblock.enabled'] ?? true;
|
||||
const notifications = prefs['sponsorblock.show_notifications'] ?? true;
|
||||
const outro = prefs['sponsorblock.categories']?.outro?.option ?? 'manual_skip';
|
||||
if (enabled !== true || notifications !== true || outro !== 'manual_skip') {
|
||||
console.log(`\nFAILED: SponsorBlock fixture not met (enabled=${enabled} notifications=${notifications} outro=${outro}).`);
|
||||
console.log(' The sbskip spec needs sponsorblock.enabled=true, show_notifications=true and the outro');
|
||||
console.log(' category on manual_skip (the defaults) — clear the Playlet/user_prefs overrides or fix them in Settings.');
|
||||
await ecp.sendKeypress(Key.Home);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(' SponsorBlock fixture: enabled + notifications + outro=manual_skip ✓');
|
||||
}
|
||||
|
||||
// Deep-link a video and wait for playback. Polls #VideoPlayer.state (the player node can appear late — live
|
||||
// manifests take ~20s). Returns false if it never reaches "playing" (e.g. an offline live id).
|
||||
export async function launch(contentId: string, timeoutMs = 30_000): Promise<boolean> {
|
||||
setupEnvironment(AppId.DEV);
|
||||
console.log(`launch: contentId=${contentId}`);
|
||||
await ecp.sendLaunchChannel({ params: { contentId } });
|
||||
const start = Date.now();
|
||||
while (Date.now() - start < timeoutMs) {
|
||||
let state: string | undefined;
|
||||
try {
|
||||
state = await field<string>('#VideoPlayer.state');
|
||||
} catch {
|
||||
state = undefined;
|
||||
}
|
||||
if (state === 'playing') {
|
||||
await assertPlayerIsDev();
|
||||
return true;
|
||||
}
|
||||
if (state === 'error') {
|
||||
console.log(' player entered state=error');
|
||||
return false;
|
||||
}
|
||||
await ecp.sleep(500);
|
||||
}
|
||||
console.log(' player did not reach state=playing within timeout');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Deep-link a known-good VOD and hard-fail if it never plays (a real failure, not a skip).
|
||||
export async function launchVod(contentId: string): Promise<void> {
|
||||
const playing = await launch(contentId);
|
||||
if (!playing) {
|
||||
console.log(`\nFAILED: known-good VOD ${contentId} never reached "playing" — a real failure, not a skip.`);
|
||||
await ecp.sendKeypress(Key.Home);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// Tear down (Home) and exit non-zero on any hard failure; skipped=true (precondition not met) reports as a pass.
|
||||
export async function finish(skipped = false): Promise<never> {
|
||||
try {
|
||||
await odc.shutdown();
|
||||
} catch {
|
||||
/* odc may not be connected */
|
||||
}
|
||||
await ecp.sendKeypress(Key.Home);
|
||||
if (soft.length) {
|
||||
console.log(`\n${soft.length} soft warning(s):`);
|
||||
soft.forEach((s) => console.log(` ⚠ ${s}`));
|
||||
}
|
||||
if (skipped) {
|
||||
console.log('\nSKIPPED (precondition not met) — treated as pass.');
|
||||
process.exit(0);
|
||||
}
|
||||
if (failures.length) {
|
||||
console.log(`\nFAILED — ${failures.length} assertion(s):`);
|
||||
failures.forEach((f) => console.log(` ✗ ${f}`));
|
||||
process.exit(1);
|
||||
}
|
||||
console.log('\nPASSED ✓');
|
||||
process.exit(0);
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
// VideoPlayerDev live e2e: on the trackbar, OK toggles the HUD without pausing (stock live faithfulness);
|
||||
// Rewind enters the live-DVR ladder. Live streams are unstable, so this skips cleanly when none is available
|
||||
// and the DVR-ladder checks are soft (a stream may expose no DVR window).
|
||||
//
|
||||
// cd references/playlet-legacy && npx tsx ./integration-tests/vpd-player-live.ts
|
||||
// PLAYER_LIVE_ID=<id> npx tsx ./integration-tests/vpd-player-live.ts # override the stream
|
||||
|
||||
import { Key, Mode, Glyph, press, launch, finish, group, field, expectField, expectSoft, waitFor, frames } from './vpd-player-harness';
|
||||
import { getLiveVideoId } from './live-id';
|
||||
|
||||
(async () => {
|
||||
// freshly-found live id (search, cached per session), then env override, then a hardcoded fallback.
|
||||
const LIVE_ID = process.env.PLAYER_LIVE_ID || (await getLiveVideoId()) || 'jfKfPfyJRdk';
|
||||
console.log(`live id: ${LIVE_ID}`);
|
||||
|
||||
const playing = await launch(LIVE_ID, 45_000);
|
||||
if (!playing) {
|
||||
console.log(`live stream ${LIVE_ID} did not start — skipping`);
|
||||
await finish(true);
|
||||
}
|
||||
|
||||
const isLive = await field<boolean>('#trickPlayBar.isLive');
|
||||
if (isLive !== true) {
|
||||
console.log(`stream ${LIVE_ID} is not live (isLive=${isLive}) — skipping`);
|
||||
await finish(true);
|
||||
}
|
||||
|
||||
group('live resting');
|
||||
await expectField('#trickPlayBar.isLive', true);
|
||||
await expectField('#VideoPlayer.state', 'playing');
|
||||
|
||||
group('OK reveals the chrome -> play/pause focused by default');
|
||||
await press(Key.Ok);
|
||||
await expectField('#Chrome.opacity', 1);
|
||||
await expectField('#VideoPlayer.state', 'playing'); // reveal doesn't pause
|
||||
await expectField('#buttonRow.rowFocused', true);
|
||||
|
||||
group('on the bar, OK toggles the HUD without pausing (live faithful)');
|
||||
await press(Key.Down); // focus the trackbar
|
||||
await expectField('#trickPlayBar.focused', true);
|
||||
await press(Key.Ok);
|
||||
await expectField('#Chrome.opacity', 0);
|
||||
await expectField('#VideoPlayer.state', 'playing');
|
||||
|
||||
group('Rewind enters the live-DVR ladder (soft — needs a DVR window)');
|
||||
await press(Key.Rewind);
|
||||
await expectSoft('#trickPlayBar.transportMode', (v) => v === Mode.liveDvr, 'rewind -> liveDvr');
|
||||
await expectSoft('#trickPlayBar.glyph', (v) => v !== Glyph.none, 'rewind glyph present');
|
||||
await expectSoft('#bifDisplay.visible', (v) => v === true, 'bif shows in liveDvr');
|
||||
|
||||
group('OK commits the ladder back to idle');
|
||||
await press(Key.Ok);
|
||||
await expectField('#trickPlayBar.transportMode', Mode.idle);
|
||||
|
||||
// Pause a live stream, let the edge run on, resume -> you're behind the edge, so the badge swaps "● LIVE" for
|
||||
// the time-behind offset. The brain drops off the edge the moment the device reports the user pause
|
||||
// (pausing live IS falling behind); the offset reads out once the post-resume duration catch-up lands.
|
||||
// Soft: needs a real DVR/pause window and a few seconds of wall clock.
|
||||
group('pause -> resume drops off the live edge and shows the offset (soft — needs DVR window)');
|
||||
await waitFor('#VideoPlayer.state', (v) => v === 'playing', 'settle the commit-to-live seek before pausing');
|
||||
const durBefore = Number(await field('#VideoPlayer.duration'));
|
||||
// verified toggle: a single ECP Play can land out of phase (eaten/raced), inverting every check after it.
|
||||
const waitState = async (want: string, ms: number) => {
|
||||
const t0 = Date.now();
|
||||
while (Date.now() - t0 < ms) {
|
||||
if ((await field('#VideoPlayer.state')) === want) return true;
|
||||
await frames(250);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
let paused = false;
|
||||
for (let i = 0; i < 2 && !paused; i++) {
|
||||
await press(Key.Play); // the play/pause key (on the bar, OK only toggles chrome)
|
||||
paused = await waitState('paused', 4000);
|
||||
}
|
||||
if (!paused) {
|
||||
console.log(' ⚠ soft: the live pause never landed (stream/keypress) — skipping the fall-behind checks');
|
||||
} else {
|
||||
await frames(10000); // let the live edge advance well past the frozen position
|
||||
let playing = false;
|
||||
for (let i = 0; i < 2 && !playing; i++) {
|
||||
await press(Key.Play);
|
||||
playing = await waitState('playing', 5000);
|
||||
}
|
||||
// duration FREEZES while paused and catches up a few seconds AFTER resume; the bar only receives the
|
||||
// projection on reveal — so wait for the catch-up BEFORE revealing (reading earlier races it).
|
||||
await waitFor('#VideoPlayer.duration', (v) => Number(v) > durBefore + 8, 'the post-resume edge catch-up landed', 15000);
|
||||
await press(Key.Ok); // reveal so the bar fields get pushed
|
||||
await frames(2500); // the forceLiveBadge reveal-hold (1.6s) releases
|
||||
await expectSoft('#trickPlayBar.atLiveEdge', (v) => v === false, 'fell behind the edge after pause');
|
||||
await expectSoft('#trickPlayBar.liveOffsetMs', (v) => v > 4000, 'shows a non-trivial time-behind offset');
|
||||
}
|
||||
|
||||
await finish();
|
||||
})();
|
||||
@@ -0,0 +1,132 @@
|
||||
// Regression for the skip-then-scrub wedge: scrub into a MANUAL SponsorBlock segment, OK to commit, OK to
|
||||
// confirm the "Press OK to skip" notice, then IMMEDIATELY Right. Old symptom: the bif thumbnails stay up over a
|
||||
// black screen with the spinner running forever (the skip-seek wedged buffering<->paused).
|
||||
//
|
||||
// Vehicle: Big Buck Bunny `aqz-KE-bpKQ`, manual `outro` 494.6–618.7s over a 634s stream, so the skip target
|
||||
// 618.7 is a real in-flight seek (not finish). Needs config: outro=manual_skip, enabled, show_notifications.
|
||||
//
|
||||
// launch() can return on an early "playing", so settle first. The verdict is read entirely over ODC (state /
|
||||
// transportMode / bif / position samples). Exits non-zero on a wedge, on a missing SponsorBlock fixture
|
||||
// (asserted up front — a disabled SponsorBlock would otherwise make this pass vacuously), and when the skip
|
||||
// never lands (position must reach the outro skip target).
|
||||
//
|
||||
// cd references/playlet-legacy && npm run test:integration:player -- sbskip
|
||||
|
||||
import { Key, ecp, odc, press, launch, finish, group, field, assertSponsorBlockFixture } from './vpd-player-harness';
|
||||
|
||||
const BBB = 'aqz-KE-bpKQ';
|
||||
const OUTRO_START_MS = 494600;
|
||||
const FF_SEEK_S = 475;
|
||||
|
||||
async function odcN(k: string): Promise<number> { return Number(await field(k)); }
|
||||
async function snap(label: string): Promise<Record<string, unknown>> {
|
||||
const ks = ['#VideoPlayer.state', '#VideoPlayer.position', '#trickPlayBar.transportMode', '#trickPlayBar.cursorMs', '#bifDisplay.visible', '#spinner.mode', '#Chrome.opacity'];
|
||||
const o: Record<string, unknown> = {};
|
||||
for (const k of ks) { try { o[k] = await field(k); } catch { o[k] = '<err>'; } }
|
||||
console.log(` [ODC @ ${label}] ` + ks.map((k) => `${k.replace('#', '')}=${JSON.stringify(o[k])}`).join(' '));
|
||||
return o;
|
||||
}
|
||||
|
||||
(async () => {
|
||||
// running standalone, press Home first if ODC/#id reads look contaminated by a ghost player (the chain's
|
||||
// prior finish()->Home handles it).
|
||||
const ok = await launch(BBB);
|
||||
if (!ok) { console.log('launch failed — skipping (no network / video unavailable)'); await finish(true); }
|
||||
|
||||
group('fixture: SponsorBlock must be ON with outro=manual_skip (else this spec is vacuous)');
|
||||
await assertSponsorBlockFixture();
|
||||
|
||||
group('settle the freshly-launched player');
|
||||
await ecp.sleep(5000);
|
||||
const duration = await odcN('#VideoPlayer.duration');
|
||||
console.log(` BBB duration=${duration}s -> outro skip 618.7 is ${duration > 620.7 ? 'a REAL in-flight SEEK' : 'FINISH (near EOF)'}`);
|
||||
|
||||
group('fixture: fast-forward to just before the outro (idle ODC seek)');
|
||||
await odc.setValue({ base: 'scene', keyPath: '#VideoPlayer.seek', value: FF_SEEK_S });
|
||||
for (let i = 0; i < 30; i++) { if ((await odcN('#VideoPlayer.position')) >= FF_SEEK_S - 3) break; await ecp.sleep(250); }
|
||||
await snap('fast-forward landing');
|
||||
|
||||
group('scrub into the outro from HIDDEN chrome (Right -> transport scrub; ~5s/press from 475)');
|
||||
for (let i = 0; i < 11; i++) { await press(Key.Right); await ecp.sleep(250); } // pace the scrub steps
|
||||
const m = await snap('mid-scrub');
|
||||
if (Number(m['#trickPlayBar.transportMode']) !== 1) { console.log(' scrub did NOT engage — skipping (environment)'); await finish(true); }
|
||||
|
||||
group('commit (OK) -> seek to cursor + resume inside the outro');
|
||||
await press(Key.Ok);
|
||||
|
||||
group('ODC gate: wait until PLAYING inside the outro, then +2.5s so OnPosition arms the manual notice');
|
||||
let armed = false;
|
||||
for (let i = 0; i < 50; i++) {
|
||||
const st = await field<string>('#VideoPlayer.state');
|
||||
const pos = await odcN('#VideoPlayer.position');
|
||||
if (st === 'playing' && pos * 1000 >= OUTRO_START_MS + 2000 && pos * 1000 < 618700) { armed = true; break; }
|
||||
await ecp.sleep(300);
|
||||
}
|
||||
console.log(` playing-inside-outro=${armed} position=${await odcN('#VideoPlayer.position')}s`);
|
||||
if (!armed) {
|
||||
// the fixture is verified, and reaching the outro is plain transport+seek — not arming is a real failure.
|
||||
console.log('\nFAILED: never reached "playing inside outro" with the SponsorBlock fixture verified.');
|
||||
try { await odc.shutdown(); } catch { /* */ }
|
||||
await ecp.sendKeypress(Key.Home);
|
||||
process.exit(1);
|
||||
}
|
||||
await ecp.sleep(2500); // let OnPosition fire a few times -> stash manualSkipSegment + show the notice
|
||||
const posBefore = await odcN('#VideoPlayer.position');
|
||||
console.log(` position before OK=${posBefore}s`);
|
||||
|
||||
group('THE BUG: OK confirms the skip -> 120ms -> Right (scrub starts while the skip-seek is in flight)');
|
||||
await ecp.sendKeypress(Key.Ok);
|
||||
await ecp.sleep(120);
|
||||
await ecp.sendKeypress(Key.Right);
|
||||
|
||||
group('characterize over 8s: wedge (bif visible + video not progressing) vs recover');
|
||||
let lastPos = -1, frozenCount = 0;
|
||||
const samples: Record<string, unknown>[] = [];
|
||||
for (let i = 0; i < 16; i++) {
|
||||
await ecp.sleep(500);
|
||||
const st = await field<string>('#VideoPlayer.state');
|
||||
const mode = await odcN('#trickPlayBar.transportMode');
|
||||
const bif = await field<boolean>('#bifDisplay.visible');
|
||||
const pos = await odcN('#VideoPlayer.position');
|
||||
const spin = await odcN('#spinner.mode');
|
||||
if (st !== 'playing' && pos === lastPos) frozenCount++; else frozenCount = 0;
|
||||
lastPos = pos;
|
||||
samples.push({ st, mode, bif, pos });
|
||||
console.log(` t+${((i + 1) * 0.5).toFixed(1)}s state=${JSON.stringify(st)} mode=${mode} bif=${bif} pos=${pos} spin=${spin}`);
|
||||
}
|
||||
|
||||
// Classify the tail: the wedge is the video stuck BUFFERING under the bif (never a frame). A scrub that
|
||||
// settles to PAUSED with the bif (a frozen frame) is the correct result of "skip then Right"; the bif over a
|
||||
// sustained PLAYING video is also impossible. Position must be frozen.
|
||||
const tail = samples.slice(-6);
|
||||
// The skip must have LANDED: the OK confirmed a seek to the outro end (618.7s). A tail still in the low
|
||||
// 500s means the manual notice never armed and OK just play/pause-toggled — the vacuous run this spec
|
||||
// must reject, not pass.
|
||||
const skipLanded = tail.every((s) => Number(s.pos) >= 610);
|
||||
const blackWedge = tail.filter((s) => s.st === 'buffering').length >= 4;
|
||||
const playsUnderBif = tail.filter((s) => s.st === 'playing' && s.bif === true).length >= 3;
|
||||
const settledPausedScrub = tail.every((s) => s.st === 'paused' && s.bif === true);
|
||||
const posFrozen = new Set(tail.map((s) => s.pos)).size <= 2;
|
||||
console.log(`\n===== VERDICT =====`);
|
||||
console.log(` all samples: ${JSON.stringify(samples.map((s) => `${s.st}/m${s.mode}/${s.bif ? 'bif' : '---'}/${s.pos}`))}`);
|
||||
console.log(` blackWedge(buffering stuck)=${blackWedge} playsUnderBif=${playsUnderBif} pausedScrub=${settledPausedScrub} posFrozen=${posFrozen} skipLanded=${skipLanded}`);
|
||||
|
||||
if (!skipLanded) {
|
||||
console.log('\n*** FAILED: the confirmed skip never landed (position stayed before the outro end) — the manual notice did not arm. ***');
|
||||
try { await odc.shutdown(); } catch { /* */ }
|
||||
await ecp.sendKeypress(Key.Home);
|
||||
process.exit(1);
|
||||
}
|
||||
if (blackWedge || playsUnderBif) {
|
||||
console.log('\n*** BUG STILL PRESENT: impossible state (bif over a stuck/playing video). ***');
|
||||
try { await odc.shutdown(); } catch { /* */ }
|
||||
await ecp.sendKeypress(Key.Home);
|
||||
process.exit(1);
|
||||
}
|
||||
// The black/loading wedge is fixed: the video reaches a paused frame (not black), position frozen.
|
||||
// It does not cleanly settle — at this end-of-content position the device keeps reporting "playing" and the
|
||||
// guard re-pauses it, so this is a residual near-EOF re-pause loop, not a clean idle.
|
||||
console.log(`\n*** WEDGE FIXED: ${settledPausedScrub ? 'paused frame + bif, position frozen' : 'final=' + JSON.stringify(tail[tail.length - 1])}.`);
|
||||
console.log(` Residual: end-of-content re-pause loop (the guard absorbs a device auto-resume; position frozen → no playback leaks). ***`);
|
||||
await finish();
|
||||
})();
|
||||
@@ -0,0 +1,74 @@
|
||||
// VideoPlayerDev VOD transport e2e: drive the transport over ECP and assert the renderer/Video state over ODC.
|
||||
//
|
||||
// cd references/playlet-legacy && npx tsx ./integration-tests/vpd-player-transport.ts
|
||||
|
||||
import { Key, Mode, Glyph, press, launchVod, finish, group, expectField, expectPred, expectSoft, expectMediaState } from './vpd-player-harness';
|
||||
|
||||
const CONTENT_ID = 'jNQXAC9IVRw'; // "Me at the zoo" — short, always-available
|
||||
|
||||
(async () => {
|
||||
await launchVod(CONTENT_ID);
|
||||
|
||||
group('resting (playing, chrome hidden)');
|
||||
await expectField('#VideoPlayer.state', 'playing');
|
||||
await expectField('#Chrome.opacity', 0);
|
||||
await expectField('#bifDisplay.visible', false);
|
||||
await expectField('#trickPlayBar.transportMode', Mode.idle);
|
||||
await expectField('#spinner.mode', 0);
|
||||
|
||||
group('OK reveals chrome (playing + hidden -> reveal, no pause)');
|
||||
await press(Key.Ok);
|
||||
await expectField('#Chrome.opacity', 1);
|
||||
await expectField('#Chrome.visible', true);
|
||||
await expectField('#buttonRow.visible', true);
|
||||
await expectField('#VideoPlayer.state', 'playing');
|
||||
|
||||
group('OK pauses (playing + shown -> pause + LargePause)');
|
||||
await press(Key.Ok);
|
||||
await expectMediaState('pause');
|
||||
await expectField('#VideoPlayer.state', 'paused');
|
||||
await expectPred('#largePause.phase', (v) => v > 0, 'pause poster animating', 1500);
|
||||
await expectField('#Chrome.opacity', 1); // chrome stays up on pause
|
||||
|
||||
group('OK resumes (paused + shown -> resume, hide chrome)');
|
||||
await press(Key.Ok);
|
||||
await expectMediaState('play');
|
||||
await expectField('#VideoPlayer.state', 'playing');
|
||||
await expectField('#Chrome.opacity', 0);
|
||||
|
||||
group('Left enters scrub (instant reveal, bif shows)');
|
||||
await press(Key.Left);
|
||||
await expectField('#trickPlayBar.transportMode', Mode.scrub);
|
||||
await expectField('#bifDisplay.transportMode', Mode.scrub);
|
||||
await expectField('#bifDisplay.visible', true);
|
||||
await expectField('#Chrome.opacity', 1);
|
||||
|
||||
group('repeated Left stays scrub (no re-trigger)');
|
||||
await press(Key.Left);
|
||||
await expectField('#trickPlayBar.transportMode', Mode.scrub);
|
||||
await expectField('#bifDisplay.visible', true);
|
||||
|
||||
group('OK commits scrub -> idle (bif self-hides)');
|
||||
await press(Key.Ok);
|
||||
await expectField('#trickPlayBar.transportMode', Mode.idle);
|
||||
await expectField('#bifDisplay.visible', false);
|
||||
await expectMediaState('play');
|
||||
|
||||
group('Rewind enters scan ladder (glyph + bif)');
|
||||
await press(Key.Rewind);
|
||||
await expectField('#trickPlayBar.transportMode', Mode.scan);
|
||||
await expectPred('#trickPlayBar.glyph', (v) => v !== Glyph.none, 'scan glyph present');
|
||||
await expectField('#bifDisplay.visible', true);
|
||||
|
||||
group('OK commits scan -> idle');
|
||||
await press(Key.Ok);
|
||||
await expectField('#trickPlayBar.transportMode', Mode.idle);
|
||||
await expectField('#bifDisplay.visible', false);
|
||||
|
||||
group('InstantReplay flashes the replay glyph (transient, soft)');
|
||||
await press(Key.Replay);
|
||||
await expectSoft('#trickPlayBar.glyph', (v) => v === Glyph.replay, 'transient replay glyph', 700);
|
||||
await expectField('#Chrome.opacity', 1); // replay reveals the chrome
|
||||
|
||||
await finish();
|
||||
})();
|
||||
@@ -0,0 +1,30 @@
|
||||
// Runs the VideoPlayerDev on-device integration specs (each a standalone tsx script that exits non-zero on
|
||||
// failure). With no args runs them all; pass filter substrings to run a subset:
|
||||
// npm run test:integration:player -- transport (only transport)
|
||||
// npm run test:integration:player -- live sbskip (live + sbskip)
|
||||
// Requires the lib built with `#const USE_DEV_PLAYER = true` — the specs assert #VideoPlayer is VideoPlayerDev.
|
||||
import { spawnSync } from 'node:child_process';
|
||||
|
||||
const SPECS = ['transport', 'buttonrow', 'bif', 'adversarial', 'live', 'sbskip'];
|
||||
|
||||
const filters = process.argv.slice(2).map((f) => f.toLowerCase());
|
||||
const selected = filters.length === 0 ? SPECS : SPECS.filter((s) => filters.some((f) => s.includes(f)));
|
||||
|
||||
if (selected.length === 0) {
|
||||
console.error(`No player spec matches [${filters.join(', ')}]. Available: ${SPECS.join(', ')}`);
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
console.log(`Running player spec(s): ${selected.join(', ')}`);
|
||||
const failed: string[] = [];
|
||||
for (const spec of selected) {
|
||||
console.log(`\n===== player-${spec} =====`);
|
||||
const res = spawnSync('npx', ['tsx', `integration-tests/vpd-player-${spec}.ts`], { stdio: 'inherit' });
|
||||
if (res.status !== 0) failed.push(spec);
|
||||
}
|
||||
|
||||
if (failed.length > 0) {
|
||||
console.error(`\nFAILED spec(s): ${failed.join(', ')}`);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(`\nAll ${selected.length} player spec(s) passed.`);
|
||||
@@ -1,71 +1,79 @@
|
||||
{
|
||||
"name": "playlet",
|
||||
"version": "0.41.8",
|
||||
"version": "0.48.0",
|
||||
"description": "Unofficial YouTube client for Roku",
|
||||
"devDependencies": {
|
||||
"@rokucommunity/bslint": "^0.8.34",
|
||||
"@rokucommunity/bslint": "^0.8.44",
|
||||
"@types/crypto-js": "^4.2.2",
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@types/node": "^24.3.1",
|
||||
"@types/node": "^25.9.3",
|
||||
"@types/xml2js": "^0.4.14",
|
||||
"argparse": "^2.0.1",
|
||||
"brighterscript": "0.68.5",
|
||||
"brighterscript-formatter": "^1.7.17",
|
||||
"brighterscript": "0.72.5",
|
||||
"brighterscript-formatter": "^1.7.27",
|
||||
"convert-svg-to-png": "^0.7.1",
|
||||
"crypto-js": "^4.2.0",
|
||||
"dotenv": "^17.2.2",
|
||||
"fs-extra": "^11.3.1",
|
||||
"glob": "^11.0.3",
|
||||
"dotenv": "^17.4.2",
|
||||
"fs-extra": "^11.3.5",
|
||||
"glob": "^13.0.6",
|
||||
"imap": "^0.8.19",
|
||||
"ip": "^2.0.1",
|
||||
"json5": "^2.2.3",
|
||||
"mailparser": "^3.7.4",
|
||||
"protocol-buffers-schema": "^3.6.0",
|
||||
"puppeteer": "^24.19.0",
|
||||
"roku-deploy": "^3.13.0",
|
||||
"roku-test-automation": "^2.0.13",
|
||||
"rooibos-roku": "5.15.7",
|
||||
"mailparser": "^3.9.9",
|
||||
"protocol-buffers-schema": "^3.6.1",
|
||||
"puppeteer": "^25.1.0",
|
||||
"roku-deploy": "^3.17.6",
|
||||
"roku-test-automation": "^2.2.2",
|
||||
"rooibos-roku": "5.16.4",
|
||||
"rounded-rect-9patch": "^1.1.2",
|
||||
"semver": "^7.7.2",
|
||||
"semver": "^7.8.4",
|
||||
"shelljs": "^0.10.0",
|
||||
"telnet-client": "^2.2.13",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "5.9.2",
|
||||
"typescript": "6.0.3",
|
||||
"xml2js": "^0.6.2",
|
||||
"yaml": "^2.8.1"
|
||||
"yaml": "^2.9.0",
|
||||
"youtubei.js": "^17.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "22"
|
||||
},
|
||||
"scripts": {
|
||||
"dev:web": "cd playlet-web && npm run dev",
|
||||
"prebuild": "rm -rf dist",
|
||||
"build:dev": "npm run build:web && npm run build:lib:dev && npm run build:app:dev",
|
||||
"build:prod": "npm run build:web && npm run build:lib:prod && npm run build:app:prod",
|
||||
"build:release": "npm run format:fix && npm run lint:fix && npm run version-sync && npm run manifest-git-hash && npm run build:prod",
|
||||
"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: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: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:prod": "cd playlet-app && npm run build:prod",
|
||||
"build:lib:dev": "cd playlet-lib && npm run build:dev",
|
||||
"build:lib:prod": "cd playlet-lib && npm run build:prod",
|
||||
"build:web": "cd playlet-web && npm run build",
|
||||
"build:playground": "cd playground && npm run build",
|
||||
"lint": "cd playlet-lib && npm run lint && cd ../playlet-app && npm run lint && cd ../playlet-web && npm run lint",
|
||||
"lint:fix": "cd playlet-lib && npm run lint:fix && cd ../playlet-app && npm run lint:fix && cd ../playlet-web && npm run lint",
|
||||
"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",
|
||||
"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:app": "cd playlet-app && npm run test",
|
||||
"test:build:app": "cd playlet-app && npm run test:build",
|
||||
"test:lib": "cd playlet-lib && npm run test",
|
||||
"test:build:lib": "cd playlet-lib && npm run test:build",
|
||||
"test:integration": "npx tsx ./integration-tests/play-video.ts",
|
||||
"test:integration:player": "npx tsx ./integration-tests/vpd-run-player.ts",
|
||||
"version-sync": "node tools/version-sync.js",
|
||||
"manifest-git-hash": "node tools/update-manifest-git-hash.js",
|
||||
"sign-released-package": "node tools/sign-released-package.js",
|
||||
"screenshot": "node tools/screenshot.js",
|
||||
"convert-images": "node tools/convert-images.js",
|
||||
"update-rale-component": "cd tools/RALE && rm TrackerTask.xml && curl -o TrackerTask.zip https://devtools.web.roku.com/roku-advanced-layout-editor/app/TrackerTask.zip && unzip TrackerTask.zip && rm TrackerTask.zip",
|
||||
"postinstall": "cd playlet-lib && npm install && cd ../playlet-app && npm install && cd ../playlet-web && npm install",
|
||||
"update-deps": "npx npm-check-updates --deep --upgrade --install always --reject tailwindcss,brighterscript,daisyui",
|
||||
"postinstall": "cd playlet-lib && npm install && cd ../playlet-app && npm install && cd ../playground && npm install && cd ../playlet-web && npm install",
|
||||
"update-deps": "npx npm-check-updates --deep --upgrade --install always --reject typescript,svelte-preprocess",
|
||||
"registry:write": "node tools/registry.js --input registry.json",
|
||||
"registry:read": "node tools/registry.js --output registry.json",
|
||||
"registry:clear": "node tools/registry.js --clear",
|
||||
@@ -74,6 +82,6 @@
|
||||
"shutdown": "node tools/shutdown.js"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@rollup/rollup-linux-x64-gnu": "^4.50.0"
|
||||
"@rollup/rollup-linux-x64-gnu": "^4.61.1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
# Playground
|
||||
|
||||
Playground is a test project to try things out or iterate on a concept.
|
||||
|
||||
Playlet app relies on playlet lib, and playlet lib relies on web app, so sometimes iteration speed can be slower when building everything everytime.
|
||||
|
||||
Just like Playlet, Playground can be launched from the VSCode "Run and debug" menu.
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "../config/bsconfig.base.jsonc",
|
||||
"rootDir": "src/",
|
||||
"stagingDir": "../build/playground",
|
||||
"outFile": "../dist/playground.zip"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "bsconfig.json",
|
||||
"createPackage": false,
|
||||
"deploy": false,
|
||||
"retainStagingDir": false,
|
||||
"sourceMap": false
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "../config/bsconfig.tests.base.jsonc",
|
||||
"rootDir": "src/",
|
||||
"stagingDir": "../build/playground-tests",
|
||||
"outFile": "../build/playground-tests.zip"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "playground",
|
||||
"version": "0.1.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playground",
|
||||
"version": "0.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "playground",
|
||||
"version": "0.1.0",
|
||||
"description": "A playground for testing Roku development",
|
||||
"scripts": {
|
||||
"prebuild": "node ../tools/rm.js ../build/playground",
|
||||
"build": "bsc --debug --create-package --sourceMap=true --lintConfig ../config/bslint.jsonc",
|
||||
"lint": "bslint --project bsconfig.lint.json --lintConfig ../config/bslint.jsonc",
|
||||
"lint:fix": "npm run lint -- --fix",
|
||||
"format:base": "bsfmt \"src/**/*.brs\" \"src/**/*.bs\" \"!**/bslib.brs\" \"!**/roku_modules/**/*\" --bsfmt-path ../config/bsfmt.jsonc",
|
||||
"format": "npm run format:base -- --check",
|
||||
"format:fix": "npm run format:base -- --write",
|
||||
"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:run": "node ../tools/run-test-app.js --package ../build/playground-tests.zip"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
function Init()
|
||||
print "Playground Init"
|
||||
end function
|
||||
@@ -0,0 +1,10 @@
|
||||
<component name="Playground" extends="Scene">
|
||||
<interface>
|
||||
<field id="exitChannel" type="bool" alwaysNotify="true" />
|
||||
<field id="launchArgs" type="assocarray" />
|
||||
<field id="inputArgs" type="assocarray" alwaysNotify="true" />
|
||||
</interface>
|
||||
<children>
|
||||
<Label text="Welcome to Playlet Playground!" />
|
||||
</children>
|
||||
</component>
|
||||
|
After Width: | Height: | Size: 9.9 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,31 @@
|
||||
title=Playlet Playground
|
||||
|
||||
major_version=0
|
||||
minor_version=1
|
||||
build_version=00000
|
||||
|
||||
ui_resolutions=hd
|
||||
uri_resolution_autosub=$$RES$$,480p,720p,1080p
|
||||
|
||||
## Channel Assets
|
||||
### Main Menu Icons / Channel Poster Artwork
|
||||
#### Image sizes are FHD: 540x405px | HD: 290x218px | SD: 246x140px
|
||||
mm_icon_focus_fhd=pkg:/images/channel-poster_fhd.png
|
||||
mm_icon_focus_hd=pkg:/images/channel-poster_hd.png
|
||||
mm_icon_focus_sd=pkg:/images/channel-poster_sd.png
|
||||
|
||||
### Splash Screen + Loading Screen Artwork
|
||||
#### Image sizes are FHD: 1920x1080px | HD: 1280x720px | SD: 720x480px
|
||||
splash_screen_fhd=pkg:/images/splash-screen_fhd.jpg
|
||||
splash_screen_hd=pkg:/images/splash-screen_hd.jpg
|
||||
splash_screen_sd=pkg:/images/splash-screen_sd.jpg
|
||||
|
||||
splash_color=#242424
|
||||
splash_min_time=0
|
||||
|
||||
confirm_partner_button=1
|
||||
|
||||
supports_input_launch=1
|
||||
|
||||
requires_widevine_drm=1
|
||||
requires_widevine_version=1.0
|
||||
@@ -0,0 +1,56 @@
|
||||
' Playlet (App to play videos from an Invidious server on Roku TVs)
|
||||
' Copyright (C) 2025 Brahim Hadriche
|
||||
|
||||
' This program is free software: you can redistribute it and/or modify
|
||||
' it under the terms of the GNU Affero General Public License as published by
|
||||
' the Free Software Foundation, either version 3 of the License, or
|
||||
' (at your option) any later version.
|
||||
|
||||
' This program is distributed in the hope that it will be useful,
|
||||
' but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
' GNU Affero General Public License for more details.
|
||||
|
||||
' You should have received a copy of the GNU Affero General Public License
|
||||
' along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
function Main(args as object) as void
|
||||
screen = CreateObject("roSGScreen")
|
||||
port = CreateObject("roMessagePort")
|
||||
screen.setMessagePort(port)
|
||||
|
||||
scene = screen.CreateScene("Playground")
|
||||
screen.show()
|
||||
|
||||
scene.ObserveField("exitChannel", port)
|
||||
scene.launchArgs = args
|
||||
|
||||
input = CreateObject("roInput")
|
||||
input.setMessagePort(port)
|
||||
|
||||
' The following comment is to enable the SceneGraph inspector
|
||||
' on the VSCode BrightScript plugin.
|
||||
' vscode_rdb_on_device_component_entry
|
||||
|
||||
' The following comment is to enable RALE tracking
|
||||
' vscode_rale_tracker_entry
|
||||
|
||||
while true
|
||||
msg = wait(0, port)
|
||||
msgType = type(msg)
|
||||
if msgType = "roSGScreenEvent"
|
||||
if msg.isScreenClosed()
|
||||
return
|
||||
end if
|
||||
else if msgType = "roSGNodeEvent"
|
||||
field = msg.getField()
|
||||
data = msg.getData()
|
||||
if field = "exitChannel" and data = true
|
||||
return
|
||||
end if
|
||||
else if msgType = "roInputEvent"
|
||||
scene.inputArgs = msg.getInfo()
|
||||
end if
|
||||
end while
|
||||
|
||||
end function
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet-app",
|
||||
"version": "0.41.8",
|
||||
"version": "0.48.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-app",
|
||||
"version": "0.41.8"
|
||||
"version": "0.48.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,26 @@
|
||||
{
|
||||
"name": "playlet-app",
|
||||
"version": "0.41.8",
|
||||
"version": "0.48.0",
|
||||
"description": "Unofficial YouTube client for Roku",
|
||||
"scripts": {
|
||||
"prebuild": "rm -rf ../build/playlet-app",
|
||||
"prebuild": "node ../tools/rm.js ../build/playlet-app",
|
||||
"prebuild:dev": "npm run prebuild",
|
||||
"prebuild:prod": "npm run prebuild",
|
||||
"build:dev": "bsc --create-package --debug --sourceMap=true --lintConfig ../config/bslint.jsonc",
|
||||
"build:prod": "bsc --create-package --sourceMap=false --lintConfig ../config/bslint.jsonc",
|
||||
"postbuild:prod": "mkdir -p ../release && cp ../dist/playlet-app.zip ../release/playlet.zip && npm run squash-fs && npm run sign-package",
|
||||
"postbuild:prod": "node ../tools/mkdir.js ../release && node ../tools/cp.js ../dist/playlet-app.zip ../release/playlet.zip && npm run squash-fs && npm run sign-package",
|
||||
"squash-fs": "node ../tools/squash-fs.js --in-file ../release/playlet.zip --out-file ../release/playlet.squashfs.zip",
|
||||
"sign-package": "node ../tools/sign-package.js --out-file playlet.squashfs.zip --out-dir ../release --staging-dir ../build/playlet-app",
|
||||
"lint": "bslint --project bsconfig.lint.json --lintConfig ../config/bslint.jsonc",
|
||||
"lint:fix": "npm run lint -- --fix",
|
||||
"format:base": "bsfmt \"src/**/*.brs\" \"src/**/*.bs\" \"!**/bslib.brs\" \"!**/roku_modules/**/*\" \"!**/*.transpiled/**\" \"!**/*.transpiled.*\" --bsfmt-path ../config/bsfmt.jsonc",
|
||||
"format:base": "bsfmt \"src/**/*.brs\" \"src/**/*.bs\" \"!**/bslib.brs\" \"!**/roku_modules/**/*\" --bsfmt-path ../config/bsfmt.jsonc",
|
||||
"format": "npm run format:base -- --check",
|
||||
"format:fix": "npm run format:base -- --write",
|
||||
"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: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="systemLogEvent" type="assocarray" alwaysNotify="true" />
|
||||
<field id="enableSystemLogType" type="string" />
|
||||
<field id="lastExitInfo" type="assocarray" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="pkg:/source/Dialog.bs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/Manifest.bs" />
|
||||
|
||||
@@ -37,6 +37,7 @@ function GetLoadingMessagesFromCache() as object
|
||||
if messagesFile = ""
|
||||
return invalid
|
||||
end if
|
||||
' bs:disable-next-line NO_PARSE_JSON
|
||||
return ParseJson(messagesFile)
|
||||
end function
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 9.9 KiB |
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
@@ -3,21 +3,21 @@
|
||||
outputs: [
|
||||
{
|
||||
outputFilePath: 'images/splash-screen_fhd.jpg',
|
||||
outputHash: '114d19754dea31c83f17355d8741ac35',
|
||||
outputHash: '02283ce80f77a11e68914592873fc7b5',
|
||||
width: 1920,
|
||||
height: 1080,
|
||||
background: '#242424',
|
||||
},
|
||||
{
|
||||
outputFilePath: 'images/splash-screen_hd.jpg',
|
||||
outputHash: '8592e44c5d00183af4c45402f6fd495c',
|
||||
outputHash: '9b6a24534c5b82a98ca6a7c26f4838e3',
|
||||
width: 1280,
|
||||
height: 720,
|
||||
background: '#242424',
|
||||
},
|
||||
{
|
||||
outputFilePath: 'images/splash-screen_sd.jpg',
|
||||
outputHash: '5a5585def512912739a2fc771971fcdd',
|
||||
outputHash: '4640d7c1c612035e31b074a3d1d5ae78',
|
||||
width: 720,
|
||||
height: 480,
|
||||
background: '#242424',
|
||||
|
||||
@@ -3,21 +3,21 @@
|
||||
outputs: [
|
||||
{
|
||||
outputFilePath: 'images/channel-poster_fhd.png',
|
||||
outputHash: '1b224960fc8923434d9fd2fdd0262e02',
|
||||
outputHash: '19feebe8de4e6598f5efa85aef59cd27',
|
||||
width: 540,
|
||||
height: 405,
|
||||
background: '#EBEBEB',
|
||||
},
|
||||
{
|
||||
outputFilePath: 'images/channel-poster_hd.png',
|
||||
outputHash: 'e3177153969166fa5f7352f3e38db852',
|
||||
outputHash: '3d3794a0a0455c48470b892818fd9c77',
|
||||
width: 290,
|
||||
height: 218,
|
||||
background: '#EBEBEB',
|
||||
},
|
||||
{
|
||||
outputFilePath: 'images/channel-poster_sd.png',
|
||||
outputHash: '1dd56e1db02ca90beecc52e56160ad58',
|
||||
outputHash: '96dd31a31b53c2eb8df31cc6554f00c4',
|
||||
width: 246,
|
||||
height: 140,
|
||||
background: '#EBEBEB',
|
||||
|
||||
@@ -2,8 +2,8 @@ title=Playlet
|
||||
|
||||
# Do not update version manually, it is auto updated from package.json
|
||||
major_version=0
|
||||
minor_version=41
|
||||
build_version=00008
|
||||
minor_version=48
|
||||
build_version=00000
|
||||
|
||||
ui_resolutions=hd
|
||||
uri_resolution_autosub=$$RES$$,480p,720p,1080p
|
||||
@@ -28,6 +28,9 @@ confirm_partner_button=1
|
||||
|
||||
supports_input_launch=1
|
||||
|
||||
requires_widevine_drm=1
|
||||
requires_widevine_version=1.0
|
||||
|
||||
playlet_lib_squashfs_remote_url=https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.squashfs.pkg
|
||||
playlet_lib_zip_remote_url=https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.zip
|
||||
playlet_lib_zip_embedded_url=pkg:/lib/playlet-lib.zip
|
||||
@@ -35,4 +38,4 @@ playlet_lib_zip_debug_url=http://DEBUG_HOST_IP_ADDRESS:8086/playlet-lib.zip
|
||||
|
||||
git_commit_sha=unknown
|
||||
|
||||
bs_const=DEBUG=false;DEBUG_FALLBACK_TO_EMBEDDED=true
|
||||
bs_const=DEBUG=false;TEST_MODE=false;DEBUG_FALLBACK_TO_EMBEDDED=true
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -16,15 +16,7 @@ namespace Logger
|
||||
buffer.AppendFile(LOGS_FILE_PATH)
|
||||
end function
|
||||
|
||||
function LogLastExitInfo() 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()
|
||||
function LogLastExitInfo(lastExitInfo as object) as void
|
||||
if lastExitInfo = invalid
|
||||
return
|
||||
end if
|
||||
@@ -35,7 +27,14 @@ namespace Logger
|
||||
msg += `app_state: ${lastExitInfo.app_state}\n`
|
||||
msg += `media_player_state: ${lastExitInfo.media_player_state}\n`
|
||||
msg += `mem_limit: ${lastExitInfo.mem_limit}\n`
|
||||
msg += `console_log:\n${lastExitInfo.console_log}\n`
|
||||
|
||||
' Sometimes lastExitInfo.console_log would contain 'AppExitComplete', which
|
||||
' is used to detect test runner exits. So we don't log it in test mode.
|
||||
#if TEST_MODE
|
||||
#else
|
||||
msg += `console_log:\n${lastExitInfo.console_log}\n`
|
||||
#end if
|
||||
|
||||
msg += `********** End Last Exit Info **********\n`
|
||||
|
||||
print msg
|
||||
|
||||
@@ -24,11 +24,11 @@ function Main(args as object) as void
|
||||
Registry.ClearPlayletLibUrlsIfNeeded(args)
|
||||
Registry.ClearRegistryIfNeeded(args)
|
||||
|
||||
Logger.LogLastExitInfo()
|
||||
|
||||
scene = screen.CreateScene("BootstrapScene")
|
||||
screen.show()
|
||||
|
||||
AppManager.CaptureLastExitInfo(scene)
|
||||
|
||||
SetScenePalette(scene)
|
||||
scene.ObserveField("exitChannel", port)
|
||||
scene.launchArgs = args
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace Registry
|
||||
if urlsJson = invalid
|
||||
return invalid
|
||||
end if
|
||||
' bs:disable-next-line NO_PARSE_JSON
|
||||
urls = ParseJson(urlsJson)
|
||||
return urls
|
||||
end function
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet-lib",
|
||||
"version": "0.41.8",
|
||||
"version": "0.48.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-lib",
|
||||
"version": "0.41.8"
|
||||
"version": "0.48.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,28 @@
|
||||
{
|
||||
"name": "playlet-lib",
|
||||
"version": "0.41.8",
|
||||
"version": "0.48.0",
|
||||
"description": "Unofficial YouTube client for Roku",
|
||||
"scripts": {
|
||||
"prebuild": "rm -rf ../build/playlet-lib",
|
||||
"prebuild": "node ../tools/rm.js ../build/playlet-lib",
|
||||
"prebuild:dev": "npm run prebuild",
|
||||
"prebuild:prod": "npm run prebuild",
|
||||
"build:dev": "bsc --create-package --debug --sourceMap=true --lintConfig ../config/bslint.jsonc",
|
||||
"build:prod": "bsc --create-package --sourceMap=false --lintConfig ../config/bslint.jsonc",
|
||||
"postbuild": "mkdir -p ../release && mkdir -p ../playlet-app/src/lib && cp ../dist/playlet-lib.zip ../playlet-app/src/lib/playlet-lib.zip",
|
||||
"postbuild": "node ../tools/mkdir.js ../release && node ../tools/mkdir.js ../playlet-app/src/lib && node ../tools/cp.js ../dist/playlet-lib.zip ../playlet-app/src/lib/playlet-lib.zip",
|
||||
"postbuild:dev": "npm run postbuild",
|
||||
"postbuild:prod": "npm run postbuild && cp ../dist/playlet-lib.zip ../release/playlet-lib.zip && npm run squash-fs && npm run sign-package",
|
||||
"postbuild:prod": "npm run postbuild && node ../tools/cp.js ../dist/playlet-lib.zip ../release/playlet-lib.zip && npm run squash-fs && npm run sign-package",
|
||||
"squash-fs": "node ../tools/squash-fs.js --in-file ../release/playlet-lib.zip --out-file ../release/playlet-lib.squashfs.zip",
|
||||
"sign-package": "node ../tools/sign-package.js --out-file playlet-lib.squashfs.zip --out-dir ../release --staging-dir ../build/playlet-lib",
|
||||
"lint": "bslint --project bsconfig.lint.json --lintConfig ../config/bslint.jsonc",
|
||||
"lint:fix": "npm run lint -- --fix",
|
||||
"format:base": "bsfmt \"src/**/*.brs\" \"src/**/*.bs\" \"!**/bslib.brs\" \"!**/roku_modules/**/*\" \"!**/*.transpiled/**\" \"!**/*.transpiled.*\" --bsfmt-path ../config/bsfmt.jsonc",
|
||||
"format:base": "bsfmt \"src/**/*.brs\" \"src/**/*.bs\" \"!**/bslib.brs\" \"!**/roku_modules/**/*\" --bsfmt-path ../config/bsfmt.jsonc",
|
||||
"format": "npm run format:base -- --check",
|
||||
"format:fix": "npm run format:base -- --write",
|
||||
"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: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"
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ function ExecuteJob() as void
|
||||
return
|
||||
end if
|
||||
|
||||
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true)
|
||||
cancellation = JobGetCancellation()
|
||||
isInnertubeProfile = authToken.profileNode.type = "youtube"
|
||||
if isInnertubeProfile
|
||||
subscriptionStatus = InnertubeService.GetSubscriptionStatusForChannel(ucid, {
|
||||
@@ -32,12 +32,12 @@ function ExecuteJob() as void
|
||||
channelView.isSubscribed = subscriptionStatus.isSubscribed
|
||||
else
|
||||
service = new Invidious.InvidiousService(invidiousNode)
|
||||
subscriptionsRequest = service.GetSubscriptions(cancellation)
|
||||
if not subscriptionsRequest.IsSuccess()
|
||||
JobError("Failed to fetch subscriptions: " + subscriptionsRequest.ErrorMessage())
|
||||
subscriptionsResponse = service.GetSubscriptions(cancellation)
|
||||
if not subscriptionsResponse.IsSuccess()
|
||||
JobError("Failed to fetch subscriptions: " + subscriptionsResponse.ErrorMessage())
|
||||
return
|
||||
end if
|
||||
subscriptions = subscriptionsRequest.Json()
|
||||
subscriptions = subscriptionsResponse.Json()
|
||||
|
||||
isSubscribed = false
|
||||
for each subscription in subscriptions
|
||||
|
||||
@@ -14,7 +14,7 @@ function ExecuteJob() as void
|
||||
return
|
||||
end if
|
||||
|
||||
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true)
|
||||
cancellation = JobGetCancellation()
|
||||
service = new Invidious.InvidiousService(invidiousNode)
|
||||
|
||||
if subscribe
|
||||
|
||||
@@ -29,7 +29,7 @@ function FirstUpdate()
|
||||
Update()
|
||||
end function
|
||||
|
||||
' format time HH:MM AM/PM
|
||||
' format time "H:MM a.m./p.m." (12-hour, no leading zero on the hour)
|
||||
function Update()
|
||||
m.dateTime.Mark()
|
||||
m.dateTime.ToLocalTime()
|
||||
@@ -38,19 +38,16 @@ function Update()
|
||||
minutes = m.dateTime.GetMinutes()
|
||||
|
||||
if hours >= 12
|
||||
ampm = "PM"
|
||||
ampm = "p.m."
|
||||
else
|
||||
ampm = "AM"
|
||||
ampm = "a.m."
|
||||
end if
|
||||
hours12 = hours mod 12
|
||||
if hours12 = 0
|
||||
hours12 = 12
|
||||
end if
|
||||
|
||||
if hours > 12
|
||||
hours -= 12
|
||||
end if
|
||||
|
||||
hoursStr = hours.ToStr("%02d")
|
||||
minutesStr = minutes.ToStr("%02d")
|
||||
|
||||
m.top.text = hoursStr + ":" + minutesStr + " " + ampm
|
||||
m.top.text = hours12.ToStr() + ":" + minutes.ToStr("%02d") + " " + ampm
|
||||
end function
|
||||
|
||||
function OnDispose()
|
||||
|
||||
@@ -14,7 +14,7 @@ function ExecuteJob() as void
|
||||
end if
|
||||
|
||||
service = new Invidious.InvidiousService(invidiousNode)
|
||||
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true)
|
||||
cancellation = JobGetCancellation()
|
||||
response = service.GetChannel(contentNode.authorId, cancellation)
|
||||
|
||||
if JobIsCancelled()
|
||||
|
||||
@@ -17,7 +17,7 @@ function ExecuteJob() as void
|
||||
|
||||
service = new Invidious.InvidiousService(invidiousNode)
|
||||
instance = service.GetInstance()
|
||||
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true)
|
||||
cancellation = JobGetCancellation()
|
||||
|
||||
while true
|
||||
playlistId = contentNode.playlistId
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
<!-- Innertube fields -->
|
||||
<field id="activeIdentifyToken" type="string" />
|
||||
<field id="selectActiveIdentityEndpoint" type="assocarray" />
|
||||
<field id="thumbnail" type="uri" />
|
||||
<field id="refreshToken" type="string" />
|
||||
<field id="scope" type="string" />
|
||||
|
||||
@@ -8,7 +8,7 @@ function ExecuteJob() as void
|
||||
accessTokenObject = input.accessTokenObject
|
||||
profilesService = input.profilesService
|
||||
try
|
||||
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true)
|
||||
cancellation = JobGetCancellation()
|
||||
if InnertubeService.AuthRefreshAccessToken(accessTokenObject, cancellation)
|
||||
profileNode.expiresIn = accessTokenObject.expiresIn
|
||||
profileNode.expiresTimestamp = accessTokenObject.expiresTimestamp
|
||||
|
||||
@@ -5,6 +5,9 @@ import "pkg:/source/utils/Types.bs"
|
||||
|
||||
namespace DialogUtils
|
||||
|
||||
' Very large messages can lead to execution timeout
|
||||
const MESSAGE_LENGTH_LIMIT = 1000
|
||||
|
||||
function ShowDialogEx(options as object) as object
|
||||
currentDialog = m.top.getScene().dialog
|
||||
alwaysOnTop = false
|
||||
@@ -24,6 +27,9 @@ namespace DialogUtils
|
||||
if options.DoesExist("message")
|
||||
message = options.message
|
||||
if IsString(message)
|
||||
if message.Len() > MESSAGE_LENGTH_LIMIT
|
||||
message = message.Left(MESSAGE_LENGTH_LIMIT) + "..."
|
||||
end if
|
||||
message = message.Tokenize(`\n`).ToArray()
|
||||
end if
|
||||
dialog.message = message
|
||||
@@ -82,7 +88,10 @@ namespace DialogUtils
|
||||
end if
|
||||
|
||||
dialog = CreateObject("roSGNode", "TimedDialog")
|
||||
if GetInterface(message, "ifArray") = invalid
|
||||
if IsString(message)
|
||||
if message.Len() > MESSAGE_LENGTH_LIMIT
|
||||
message = message.Left(MESSAGE_LENGTH_LIMIT) + "..."
|
||||
end if
|
||||
message = message.Tokenize(`\n`).ToArray()
|
||||
end if
|
||||
dialog.message = message
|
||||
@@ -116,7 +125,7 @@ namespace DialogUtils
|
||||
if hasMessageId
|
||||
messages = RegistryUtils.Read(RegistryUtils.MESSAGES)
|
||||
if not StringUtils.IsNullOrEmpty(messages)
|
||||
messages = ParseJson(messages)
|
||||
messages = StringUtils.ParseJsonSafe(messages)
|
||||
if IsAssociativeArray(messages)
|
||||
savedMessageId = ValidString(messages["messageId"])
|
||||
if savedMessageId = messageId
|
||||
|
||||
@@ -11,7 +11,7 @@ function ExecuteJob() as void
|
||||
profilesNode = input.profilesService
|
||||
dialogNode = input.dialog
|
||||
|
||||
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true)
|
||||
cancellation = JobGetCancellation()
|
||||
' TODO:P2 cache client identity
|
||||
authCode = InnertubeService.AuthGetCode(cancellation)
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import "pkg:/source/utils/AssertUtils.bs"
|
||||
import "pkg:/source/utils/CancellationUtils.bs"
|
||||
import "pkg:/source/utils/ErrorUtils.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/MessagePortUtils.bs"
|
||||
@@ -22,6 +23,10 @@ function JobGetCallbackNode() as dynamic
|
||||
return m._callback
|
||||
end function
|
||||
|
||||
function JobGetCancellation() as dynamic
|
||||
return CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true)
|
||||
end function
|
||||
|
||||
function JobSuccess() as void
|
||||
callbackNode = JobGetCallbackNode()
|
||||
if callbackNode = invalid
|
||||
@@ -45,7 +50,7 @@ end function
|
||||
|
||||
function JobError(error as dynamic) as void
|
||||
error = ErrorUtils.Format(error)
|
||||
LogError(error)
|
||||
LogError(`[${m.top.subtype()}]${error}`)
|
||||
callbackNode = JobGetCallbackNode()
|
||||
if callbackNode = invalid
|
||||
return
|
||||
|
||||
@@ -3,7 +3,10 @@ import "pkg:/source/utils/MessagePortUtils.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
|
||||
' Maximum number of JobTasks that can be created
|
||||
const MAX_JOB_TASK_COUNT = 25
|
||||
' https://developer.roku.com/en-ca/docs/developer-program/core-concepts/threads.md
|
||||
' "Developers should take steps to ensure that their apps always remain well under the 50-thread "warning" limit."
|
||||
' Accounting for other types of long running Tasks in the app, this limit should be way lower than 50.
|
||||
const MAX_JOB_TASK_COUNT = 30
|
||||
' Minimum number of JobTasks that will be kept alive
|
||||
const MIN_JOB_TASK_COUNT = 2
|
||||
' Time in milliseconds to wait before scaling down JobTasks
|
||||
@@ -47,7 +50,7 @@ function JobQueueTaskLoop() as void
|
||||
jobTask.control = "run"
|
||||
else
|
||||
#if DEBUG
|
||||
LogWarn("Cannot create new JobTask. Idle:", m.idleJobTasks.Count(), ", Busy:", m.busyJobTasks.Count())
|
||||
LogWarnNoTelemetry("Cannot create new JobTask. Idle:", m.idleJobTasks.Count(), ", Busy:", m.busyJobTasks.Count())
|
||||
#end if
|
||||
end if
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ function Init()
|
||||
scene.enableSystemLogType = "http.complete"
|
||||
scene.enableSystemLogType = "bandwidth.minute"
|
||||
#end if
|
||||
m.sysLogEventDropCounter = 0
|
||||
end if
|
||||
end if
|
||||
|
||||
@@ -60,13 +59,20 @@ function LoggerLoop()
|
||||
DeleteFile(previousLogsFile)
|
||||
MoveFile(logsFile, previousLogsFile)
|
||||
|
||||
startUpLogs = ReadAsciiFile(FILENAME_STARTUP)
|
||||
if not StringUtils.IsNullOrEmpty(startUpLogs)
|
||||
line = `************* Startup Logs *************\n${startUpLogs}*********** End Startup Logs ***********\n`
|
||||
print line
|
||||
buffer.FromAsciiString(line)
|
||||
buffer.AppendFile(logsFile)
|
||||
end if
|
||||
' Sometimes lastExitInfo.console_log (which would be contained in startUpLogs)
|
||||
' would contain 'AppExitComplete', which is used to detect test runner exits.
|
||||
' So we don't log it in test mode.
|
||||
#if TEST_MODE
|
||||
#else
|
||||
startUpLogs = ReadAsciiFile(FILENAME_STARTUP)
|
||||
if not StringUtils.IsNullOrEmpty(startUpLogs)
|
||||
line = `************* Startup Logs *************\n${startUpLogs}*********** End Startup Logs ***********\n`
|
||||
print line
|
||||
buffer.FromAsciiString(line)
|
||||
buffer.AppendFile(logsFile)
|
||||
end if
|
||||
#end if
|
||||
m.eventThrottleTimer = CreateObject("roTimespan")
|
||||
|
||||
appMemoryMonitor = CreateObject("roAppMemoryMonitor")
|
||||
if appMemoryMonitor <> invalid and FindMemberFunction(appMemoryMonitor, "EnableMemoryWarningEvent") <> invalid
|
||||
@@ -109,31 +115,46 @@ function OnLineSysLog(event as object, dateTime as object, logsFile as string, b
|
||||
if info.LogType <> "http.error"
|
||||
return
|
||||
end if
|
||||
httpCode = ValidInt(info.HttpCode)
|
||||
if httpCode >= 200 and httpCode < 300
|
||||
return
|
||||
end if
|
||||
|
||||
line = FormatTime(dateTime) + "[ERROR][SysLog] " + ToString(info)
|
||||
print line
|
||||
buffer.FromAsciiString(line + `\n`)
|
||||
buffer.AppendFile(logsFile)
|
||||
|
||||
' Only report 1 in 10 system log errors
|
||||
' They're usually repetitive, one is reported for each stream in a DASH
|
||||
' when a video is blocked
|
||||
if m.sysLogEventDropCounter = 0
|
||||
LogTelemetryEvent({
|
||||
level: "error"
|
||||
message: line
|
||||
fingerprint: ["SysLog", info.Status, info.LogType, info.HttpCode, info.Method]
|
||||
})
|
||||
fingerprint = `SysLog${info.Status}${info.LogType}${httpCode}${info.Method}`
|
||||
|
||||
if ThrottleEvent("SysLogError", fingerprint, 60)
|
||||
return
|
||||
end if
|
||||
m.sysLogEventDropCounter = (m.sysLogEventDropCounter + 1) mod 10
|
||||
|
||||
LogTelemetryEvent({
|
||||
level: "error"
|
||||
message: line + `\nCurrentTime: ${m.eventThrottleTimer.TotalSeconds()}`
|
||||
fingerprint: [fingerprint]
|
||||
})
|
||||
end function
|
||||
|
||||
function OnLineLogMonitorMemoryWarning(event as object, dateTime as object, logsFile as string, buffer as object) as void
|
||||
info = event.getInfo()
|
||||
line = FormatTime(dateTime) + "[WARN][AppMonitorMemory] " + ToString(info)
|
||||
message = "[WARN][AppMonitorMemory] " + ToString(info)
|
||||
line = FormatTime(dateTime) + message
|
||||
print line
|
||||
buffer.FromAsciiString(line + `\n`)
|
||||
buffer.AppendFile(logsFile)
|
||||
m.global.telemetry.LogWarn = line
|
||||
|
||||
if ThrottleEvent("AppMonitorMemoryWarning", message, 60)
|
||||
return
|
||||
end if
|
||||
|
||||
' LogTelemetryEvent({
|
||||
' level: "warning"
|
||||
' message: line + `\nCurrentTime: ${m.eventThrottleTimer.TotalSeconds()}`
|
||||
' fingerprint: [message]
|
||||
' })
|
||||
end function
|
||||
|
||||
function OnLineLogDeviceInfoMemoryWarning(event as object, dateTime as object, logsFile as string, buffer as object) as void
|
||||
@@ -142,17 +163,35 @@ function OnLineLogDeviceInfoMemoryWarning(event as object, dateTime as object, l
|
||||
return
|
||||
end if
|
||||
|
||||
' roDeviceInfoEvent can be a bit spammy, so only log if the memory level has changed
|
||||
if info.generalMemoryLevel = m.lastDeviceInfoMemoryLevel
|
||||
if ThrottleEvent("DeviceInfoMemoryWarning", info.generalMemoryLevel, 60)
|
||||
return
|
||||
end if
|
||||
m.lastDeviceInfoMemoryLevel = info.generalMemoryLevel
|
||||
|
||||
line = FormatTime(dateTime) + "[WARN][DeviceInfoMemory] " + ToString(info)
|
||||
message = "[WARN][DeviceInfoMemory] " + ToString(info)
|
||||
line = FormatTime(dateTime) + message
|
||||
print line
|
||||
buffer.FromAsciiString(line + `\n`)
|
||||
buffer.AppendFile(logsFile)
|
||||
m.global.telemetry.LogWarn = line
|
||||
|
||||
' LogTelemetryEvent({
|
||||
' level: "warning"
|
||||
' message: line + `\nCurrentTime: ${m.eventThrottleTimer.TotalSeconds()}`
|
||||
' fingerprint: [message]
|
||||
' })
|
||||
end function
|
||||
|
||||
' Returns true if the event should be throttled
|
||||
function ThrottleEvent(key as string, fingerprint as string, throttleSeconds as integer) as boolean
|
||||
lastSentTime = ValidInt(m[key])
|
||||
currentTime = m.eventThrottleTimer.TotalSeconds()
|
||||
|
||||
if ((currentTime - lastSentTime) < throttleSeconds) and (m[key + "Fingerprint"] = fingerprint)
|
||||
return true
|
||||
end if
|
||||
|
||||
m[key] = currentTime
|
||||
m[key + "Fingerprint"] = fingerprint
|
||||
return false
|
||||
end function
|
||||
|
||||
' Note: although the timestamp should be captured in the caller, not the logger,
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
'import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
'import "pkg:/components/EcpArgs.bs"
|
||||
'import "pkg:/components/parts/AutoBind/AutoBind.part.bs"
|
||||
'import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
|
||||
'import "pkg:/source/utils/LoadingScreen.bs"
|
||||
'import "pkg:/source/utils/Locale.bs"
|
||||
|
||||
function Init()
|
||||
InitializeBindings() ' auto-generated!
|
||||
m.scene = m.top.getScene()
|
||||
SetScenePalette(m.scene)
|
||||
' At this point, the "MainScene" node is not yet added to the scene, and does not have a parent yet.
|
||||
' Let's wait until it has one.
|
||||
m.MainSceneContainer = m.scene.findNode("MainSceneContainer")
|
||||
m.MainSceneContainer.ObserveField("change", FuncName(MainSceneContainerChanged))
|
||||
end function
|
||||
|
||||
function SetScenePalette(scene as object) as void
|
||||
palette = scene.palette
|
||||
if palette <> invalid
|
||||
return
|
||||
end if
|
||||
palette = CreateObject("roSGNode", "RSGPalette")
|
||||
palette.colors = {
|
||||
DialogBackgroundColor: "#242424FF"
|
||||
DialogFocusColor: "#CECECEFF"
|
||||
DialogFocusItemColor: "#202020FF"
|
||||
DialogSecondaryTextColor: "#EBEBEBFF"
|
||||
DialogSecondaryItemColor: "#FF1C30FF"
|
||||
DialogTextColor: "#EBEBEBFF"
|
||||
}
|
||||
scene.palette = palette
|
||||
end function
|
||||
|
||||
|
||||
function MainSceneContainerChanged()
|
||||
AutoBindSceneGraph()
|
||||
StartWebServer()
|
||||
HideLoadingScreen()
|
||||
InitEcpArgs()
|
||||
if false
|
||||
if not ShowAnnouncement()
|
||||
m.scene.signalBeacon("AppLaunchComplete")
|
||||
end if
|
||||
else
|
||||
m.scene.signalBeacon("AppLaunchComplete")
|
||||
end if
|
||||
CopyLoadingMessagesToCache()
|
||||
end function
|
||||
|
||||
function StartWebServer()
|
||||
m.loungeService = m.top.findNode("LoungeService")
|
||||
m.loungeService.callfunc("StartService", invalid)
|
||||
m.webServer = m.top.findNode("WebServer")
|
||||
m.webServer.callfunc("StartServer", invalid)
|
||||
m.dialServer = m.top.findNode("DialServer")
|
||||
m.dialServer.callfunc("StartServer", invalid)
|
||||
end function
|
||||
|
||||
function ShowAnnouncement() as boolean
|
||||
dialog = DialogUtils_ShowDialogOnce({
|
||||
messageId: "1755469284"
|
||||
title: "Playback fixes - Canary build"
|
||||
message: [
|
||||
"Thank you for helping test the latest changes by using the Canary build of Playlet!"
|
||||
"If you encounter any issues with playback, please report them on the GitHub issue tracker."
|
||||
"https://github.com/iBicha/playlet/issues"
|
||||
]
|
||||
alwaysOnTop: true
|
||||
large: true
|
||||
})
|
||||
if dialog = invalid
|
||||
return false
|
||||
end if
|
||||
m.scene.signalBeacon("AppDialogInitiate")
|
||||
dialog.observeField("wasClosed", FuncName(OnAnnouncementDialogClosed))
|
||||
return true
|
||||
end function
|
||||
|
||||
function OnAnnouncementDialogClosed()
|
||||
m.scene.signalBeacon("AppDialogComplete")
|
||||
m.scene.signalBeacon("AppLaunchComplete")
|
||||
end function
|
||||
'//# sourceMappingURL=./MainScene.brs.map
|
||||
@@ -1,60 +0,0 @@
|
||||
<component name="MainScene" extends="Group">
|
||||
<interface>
|
||||
<field id="bindings" type="assocarray" onChange="OnBindingSetRegisterAutoBind" />
|
||||
<field id="binding_done" type="boolean" onChange="OnNodeReady" />
|
||||
<function name="BindNodeFieldsAndProps" />
|
||||
<function name="BindScopeFields" />
|
||||
<function name="BindNode" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="pkg:/components/parts/AutoBind/AutoBind.part.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/components/MainScene_bindings.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/NodePathUtils.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/components/MainScene.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/LoadingScreen.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/components/parts/AutoBind/OnNodeReadyNoOp.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/components/EcpArgs.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/Types.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/StringUtils.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/Logging.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/components/Dialog/DialogUtils.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/RegistryUtils.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/bslib.brs" />
|
||||
<children>
|
||||
<Logger id="Logger" />
|
||||
<JobQueue id="JobQueue" />
|
||||
<AppController id="AppController">
|
||||
<Group id="Stack">
|
||||
<AppRoot id="AppRoot">
|
||||
<AppScreens id="AppScreens" />
|
||||
<NavBar id="NavBar" initialFocus="2">
|
||||
<ContentNode role="content">
|
||||
<NavBarItemContent screen="ProfileScreen" text="Profile" isProfile="true" />
|
||||
<NavBarItemContent screen="SearchScreen" text="Search" icon="pkg:/images/icons/search.png" />
|
||||
<NavBarItemContent screen="HomeScreen" text="Home" icon="pkg:/images/icons/home.png" />
|
||||
<NavBarItemContent screen="BookmarksScreen" text="Bookmarks" icon="pkg:/images/icons/star.png" />
|
||||
<NavBarItemContent screen="SettingsScreen" text="Settings" icon="pkg:/images/icons/settings.png" />
|
||||
<NavBarItemContent screen="RemoteScreen" text="Remote" icon="pkg:/images/icons/phone.png" />
|
||||
<NavBarItemContent screen="AppInfoScreen" text="Info" icon="pkg:/images/icons/info.png" />
|
||||
</ContentNode>
|
||||
</NavBar>
|
||||
</AppRoot>
|
||||
</Group>
|
||||
<Clock />
|
||||
<VideoContainer id="VideoContainer" />
|
||||
<Group id="Notifications" />
|
||||
<VideoQueue id="VideoQueue" />
|
||||
<ApplicationInfo id="ApplicationInfo" />
|
||||
<Preferences id="Preferences" />
|
||||
<BookmarksService id="BookmarksService" />
|
||||
<SearchHistory id="SearchHistory" />
|
||||
<ProfilesService id="ProfilesService" />
|
||||
<Innertube id="Innertube" />
|
||||
<Invidious id="Invidious" />
|
||||
<PlayletWebServer id="WebServer" port="8888" />
|
||||
<DialServer id="DialServer" />
|
||||
<LoungeService id="LoungeService" />
|
||||
<Telemetry id="Telemetry" />
|
||||
</AppController>
|
||||
</children>
|
||||
</component>
|
||||
<!--//# sourceMappingURL=./MainScene.xml.map -->
|
||||
@@ -1,75 +0,0 @@
|
||||
' This method is auto-generated!
|
||||
function InitializeBindings()
|
||||
m.top.bindings = {
|
||||
fields: {
|
||||
|
||||
},
|
||||
childProps: {
|
||||
"AppController": {
|
||||
"screensContainer": "./AppScreens",
|
||||
"root": "./AppRoot",
|
||||
"stack": "./Stack",
|
||||
"videoQueue": "./VideoQueue"
|
||||
},
|
||||
"NavBar": {
|
||||
"appController": "/AppController",
|
||||
"screensContainer": "../AppScreens"
|
||||
},
|
||||
"VideoQueue": {
|
||||
"appController": "/AppController",
|
||||
"videoContainer": "../VideoContainer",
|
||||
"innertube": "../Innertube",
|
||||
"invidious": "../Invidious",
|
||||
"notifications": "../Notifications",
|
||||
"preferences": "../Preferences",
|
||||
"loungeService": "../LoungeService",
|
||||
"jobQueue": "/JobQueue"
|
||||
},
|
||||
"ApplicationInfo": {
|
||||
"jobQueue": "/JobQueue"
|
||||
},
|
||||
"SearchHistory": {
|
||||
"preferences": "../Preferences"
|
||||
},
|
||||
"ProfilesService": {
|
||||
"invidious": "../Invidious",
|
||||
"jobQueue": "/JobQueue"
|
||||
},
|
||||
"Innertube": {
|
||||
"jobQueue": "/JobQueue"
|
||||
},
|
||||
"Invidious": {
|
||||
"webServer": "../WebServer",
|
||||
"applicationInfo": "../ApplicationInfo",
|
||||
"preferences": "../Preferences",
|
||||
"profilesService": "../ProfilesService"
|
||||
},
|
||||
"WebServer": {
|
||||
"appController": "/AppController",
|
||||
"applicationInfo": "../ApplicationInfo",
|
||||
"innertube": "../Innertube",
|
||||
"invidious": "../Invidious",
|
||||
"profilesService": "../ProfilesService",
|
||||
"preferences": "../Preferences",
|
||||
"videoQueue": "../VideoQueue",
|
||||
"bookmarksService": "../BookmarksService",
|
||||
"loungeService": "../LoungeService",
|
||||
"jobQueue": "/JobQueue"
|
||||
},
|
||||
"DialServer": {
|
||||
"webServer": "../WebServer",
|
||||
"loungeService": "../LoungeService"
|
||||
},
|
||||
"LoungeService": {
|
||||
"videoQueue": "../VideoQueue",
|
||||
"notifications": "../Notifications",
|
||||
"invidious": "../Invidious"
|
||||
},
|
||||
"Telemetry": {
|
||||
"preferences": "../Preferences",
|
||||
"applicationInfo": "../ApplicationInfo"
|
||||
}
|
||||
}
|
||||
}
|
||||
end function
|
||||
'//# sourceMappingURL=./MainScene_bindings.brs.map
|
||||
@@ -6,6 +6,8 @@ namespace PlaylistUtils
|
||||
end if
|
||||
appController@.PushScreen(playlistView)
|
||||
playlistView@.BindNode()
|
||||
playlistView.content = contentNode
|
||||
' Clone the playlist because the videos will be loaded as children.
|
||||
' This allows the videos to be freed once the view is closed.
|
||||
playlistView.content = contentNode.clone(false)
|
||||
end function
|
||||
end namespace
|
||||
@@ -1,9 +1,10 @@
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
namespace HomeScreenUtils
|
||||
|
||||
function GetFeed(feedFileName as string, preferences as object) as object
|
||||
feed = ParseJson(ReadAsciiFile(feedFileName))
|
||||
feed = StringUtils.ParseJsonSafe(ReadAsciiFile(feedFileName))
|
||||
for each item in feed
|
||||
item.title = Tr(item.title)
|
||||
|
||||
|
||||
@@ -68,8 +68,8 @@ function LoginWithInvidious() as void
|
||||
DialogUtils.ShowDialogEx({
|
||||
title: "No Invidious Instance"
|
||||
message: [
|
||||
"Playlet built-in backend does not support login yet.",
|
||||
"Can only login if an Invidious instance is set in the settings."
|
||||
"Playlet built-in backend does not support Invidious login.",
|
||||
"Can only login with Invidious if an Invidious instance is set in the settings."
|
||||
]
|
||||
})
|
||||
return
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/source/utils/Locale.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
CopyFile("libpkg:/images/icons/globe-white.png", "tmp:/globe-white.png")
|
||||
CopyFile("libpkg:/images/icons/globe-black.png", "tmp:/globe-black.png")
|
||||
|
||||
m.languages = [
|
||||
{ code: "en_US", name: "English" }
|
||||
{ code: "de_DE", name: "Deutsch" }
|
||||
{ code: "es_ES", name: "Español" }
|
||||
{ code: "fr_FR", name: "Français" }
|
||||
{ code: "pt_BR", name: "Português" }
|
||||
{ code: "ru_RU", name: "Русский" }
|
||||
]
|
||||
|
||||
languageKeys = {}
|
||||
for each lang in m.languages
|
||||
languageKeys[lang.code] = true
|
||||
end for
|
||||
m.languageKeys = languageKeys
|
||||
end function
|
||||
|
||||
function OnNodeReady() as void
|
||||
OnLanguagePreferenceChanged()
|
||||
m.preferences.ObserveFieldScoped("search.keyboard_language", FuncName(OnLanguagePreferenceChanged))
|
||||
end function
|
||||
|
||||
function keySelected(key as string) as boolean
|
||||
if key = "LanguageSelect"
|
||||
OnLanguageKeySelected()
|
||||
return true
|
||||
end if
|
||||
|
||||
LogDebug("Key selected:", key)
|
||||
return false
|
||||
end function
|
||||
|
||||
function OnLanguageKeySelected() as void
|
||||
LogDebug("Language key selected")
|
||||
|
||||
buttons = []
|
||||
for each lang in m.languages
|
||||
buttons.Push(lang.name)
|
||||
end for
|
||||
|
||||
dialog = DialogUtils.ShowDialogEx({
|
||||
message: ""
|
||||
title: Tr(Locale.Dialogs.SelectKeyboardLanguage)
|
||||
buttons: buttons
|
||||
})
|
||||
if dialog = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
dialog.observeField("buttonSelected", FuncName(OnLanguageSelected), ["buttonSelected"])
|
||||
end function
|
||||
|
||||
function OnLanguageSelected(event as object) as void
|
||||
buttonIndex = event.GetData()
|
||||
|
||||
if not IsInt(buttonIndex) or buttonIndex < 0 or buttonIndex >= m.languages.Count()
|
||||
return
|
||||
end if
|
||||
|
||||
lang = m.languages[buttonIndex]
|
||||
SetCurrentLanguage(lang.code)
|
||||
m.preferences["search.keyboard_language"] = lang.code
|
||||
end function
|
||||
|
||||
function OnLanguagePreferenceChanged() as void
|
||||
language = m.preferences["search.keyboard_language"]
|
||||
if StringUtils.IsNullOrEmpty(language) or not ValidBool(m.languageKeys[language])
|
||||
LogDebug("Invalid or missing keyboard language:", language, "defaulting to en_US")
|
||||
language = "en_US"
|
||||
m.preferences["search.keyboard_language"] = language
|
||||
end if
|
||||
|
||||
SetCurrentLanguage(language)
|
||||
end function
|
||||
|
||||
function SetCurrentLanguage(code as string) as void
|
||||
if code = m.currentLanguage
|
||||
return
|
||||
end if
|
||||
|
||||
LogDebug("Setting keyboard language to", code)
|
||||
m.currentLanguage = code
|
||||
m.top.keyGrid.keyDefinitionUri = "libpkg:/config/search-kb-layout/" + code + ".json5"
|
||||
end function
|
||||
@@ -0,0 +1,6 @@
|
||||
<component name="SearchKeyboard" extends="DynamicCustomKeyboard" includes="AutoBind">
|
||||
<interface>
|
||||
<field id="preferences" type="node" bind="/Preferences" />
|
||||
<function name="keySelected" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -24,8 +24,6 @@ function Init()
|
||||
|
||||
m.rowList.screen = m.top
|
||||
|
||||
m.keyboard.keyGrid.keyDefinitionUri = "libpkg:/config/search-keyboard-layout.json5"
|
||||
|
||||
textEditBox = m.keyboard.textEditBox
|
||||
textEditBox.voiceEntryType = "generic"
|
||||
textEditBox.voiceEnabled = true
|
||||
@@ -43,6 +41,7 @@ end function
|
||||
|
||||
function OnNodeReady()
|
||||
m.rowlist@.BindNode()
|
||||
m.keyboard@.BindNode()
|
||||
m.keyboard.ObserveField("text", FuncName(OnTextChange))
|
||||
m.suggestions.ObserveField("buttonFocused", FuncName(OnSearchButtonFocused))
|
||||
m.suggestions.ObserveField("buttonSelected", FuncName(OnSearchButtonSelected))
|
||||
|
||||
@@ -18,9 +18,10 @@
|
||||
padding="[30,30]"
|
||||
text="Filters" />
|
||||
|
||||
<DynamicMiniKeyboard
|
||||
<SearchKeyboard
|
||||
id="keyboard"
|
||||
translation="[695,110]" />
|
||||
translation="[630,102]" />
|
||||
|
||||
<ButtonGroup
|
||||
id="suggestions"
|
||||
focusable="false"
|
||||
|
||||
@@ -3,13 +3,14 @@ import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/MathUtils.bs"
|
||||
import "pkg:/source/utils/RemoteKeys.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
m.homeLayout = {}
|
||||
homeLayout = ParseJson(ReadAsciiFile("libpkg:/config/default_home_layout.yaml"))
|
||||
for each item in homeLayout
|
||||
m.homeLayout[item.id] = item
|
||||
m.homeLayoutMap = {}
|
||||
homeLayoutMap = StringUtils.ParseJsonSafe(ReadAsciiFile("libpkg:/config/default_home_layout.yaml"))
|
||||
for each item in homeLayoutMap
|
||||
m.homeLayoutMap[item.id] = item
|
||||
end for
|
||||
|
||||
m.checkList = m.top.findNode("checkList")
|
||||
@@ -80,17 +81,34 @@ function OnValueChange()
|
||||
|
||||
nodes = []
|
||||
checkedState = []
|
||||
homeLayoutMap = {}
|
||||
homeLayoutMap.Append(m.homeLayoutMap)
|
||||
|
||||
for each item in value
|
||||
feed = m.homeLayout[item.id]
|
||||
feed = homeLayoutMap[item.id]
|
||||
if feed = invalid
|
||||
LogWarn("unknown feed id:", item.id)
|
||||
continue for
|
||||
end if
|
||||
homeLayoutMap.Delete(item.id)
|
||||
node = CreateObject("roSGNode", "ContentNode")
|
||||
node.id = feed.id
|
||||
node.title = Tr(feed.title)
|
||||
nodes.push(node)
|
||||
checkedState.push(item.enabled)
|
||||
end for
|
||||
|
||||
for each id in homeLayoutMap
|
||||
feed = homeLayoutMap[id]
|
||||
if feed = invalid
|
||||
LogWarn("unknown feed id:", id)
|
||||
continue for
|
||||
end if
|
||||
node = CreateObject("roSGNode", "ContentNode")
|
||||
node.id = feed.id
|
||||
node.title = Tr(feed.title)
|
||||
nodes.push(node)
|
||||
checkedState.push(item.enabled)
|
||||
checkedState.push(false)
|
||||
end for
|
||||
|
||||
labelCount = content.getChildCount()
|
||||
|
||||
@@ -20,7 +20,7 @@ function ExecuteJob() as void
|
||||
content = PrepareTests()
|
||||
listNode.content = content
|
||||
|
||||
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true)
|
||||
cancellation = JobGetCancellation()
|
||||
RunTests(instance, content, cancellation)
|
||||
end function
|
||||
|
||||
@@ -324,7 +324,7 @@ end function
|
||||
|
||||
function CanFetchWithCors(instance as string, testNode as object, cancellation as object) as void
|
||||
try
|
||||
url = `${instance}/api/v1/trending`
|
||||
url = `${instance}/api/v1/popular`
|
||||
response = HttpClient.Get(url).NoCache().Cancellation(cancellation).Await()
|
||||
|
||||
if not response.IsSuccess()
|
||||
|
||||
@@ -15,7 +15,7 @@ function ExecuteJob() as void
|
||||
return
|
||||
end if
|
||||
|
||||
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true)
|
||||
cancellation = JobGetCancellation()
|
||||
response = HttpClient.Get(Invidious.INSTANCES_API).Cancellation(cancellation).Await()
|
||||
if response.IsCancelled()
|
||||
JobCancel()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import "pkg:/components/Navigation/Navigation.bs"
|
||||
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
|
||||
import "pkg:/source/utils/CodecCapabilities.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/MathUtils.bs"
|
||||
import "pkg:/source/utils/RemoteKeys.bs"
|
||||
@@ -19,12 +20,48 @@ function Init()
|
||||
m.saveButton.observeField("buttonSelected", FuncName(OnSaveButtonSelected))
|
||||
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))
|
||||
|
||||
SetButtonPositions()
|
||||
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()
|
||||
saveButtonWidth = m.saveButton.width
|
||||
closeButtonWidth = m.closeButton.width
|
||||
@@ -99,16 +136,16 @@ function OnCheckedStateChange() as void
|
||||
|
||||
if autoChanged
|
||||
if hasAuto
|
||||
checkedState = [true, false, false, false, false, false, false]
|
||||
checkedState = NewCheckedState(true, false)
|
||||
m.lastCheckedState = checkedState
|
||||
m.checkList.checkedState = checkedState
|
||||
m.top.value = "auto"
|
||||
return
|
||||
else
|
||||
checkedState = [false, true, true, true, true, true, true]
|
||||
checkedState = NewCheckedState(false, true)
|
||||
m.lastCheckedState = checkedState
|
||||
m.checkList.checkedState = checkedState
|
||||
m.top.value = "1080p,720p,480p,360p,240p,144p"
|
||||
m.top.value = AllQualitiesValue()
|
||||
return
|
||||
end if
|
||||
end if
|
||||
@@ -128,7 +165,7 @@ function OnCheckedStateChange() as void
|
||||
end for
|
||||
|
||||
if values.Count() = 0
|
||||
checkedState = [true, false, false, false, false, false, false]
|
||||
checkedState = NewCheckedState(true, false)
|
||||
m.lastCheckedState = checkedState
|
||||
m.checkList.checkedState = checkedState
|
||||
m.top.value = "auto"
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
</Rectangle>
|
||||
<Rectangle
|
||||
width="780"
|
||||
height="600"
|
||||
translation="[250,60]"
|
||||
height="640"
|
||||
translation="[250,40]"
|
||||
color="#242424">
|
||||
<CheckList
|
||||
id="checkList"
|
||||
@@ -43,13 +43,13 @@
|
||||
iconVisible="false"
|
||||
text="Save"
|
||||
padding="[30,30]"
|
||||
translation="[340,500]" />
|
||||
translation="[340,555]" />
|
||||
<ButtonEx
|
||||
id="closeButton"
|
||||
iconVisible="false"
|
||||
text="Close"
|
||||
padding="[30,30]"
|
||||
translation="[496,500]" />
|
||||
translation="[496,555]" />
|
||||
</Rectangle>
|
||||
</children>
|
||||
</component>
|
||||
@@ -94,7 +94,7 @@ function CreateControls(item as object, container as object, startX as integer,
|
||||
|
||||
nodes = []
|
||||
for each child in item.children
|
||||
if child.visibility = "web"
|
||||
if child.visibility = "web" or child.visibility = "off"
|
||||
continue for
|
||||
end if
|
||||
control = CreateControl(child, container, startX, startY)
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
numColumns="1"
|
||||
numRows="10"
|
||||
vertFocusAnimationStyle="floatingFocus"
|
||||
translation="[40,100]"
|
||||
translation="[40,90]"
|
||||
focusBitmapUri="pkg:/images/focus-glow-padding-19.9.png" />
|
||||
|
||||
<ButtonEx
|
||||
@@ -40,13 +40,13 @@
|
||||
iconVisible="false"
|
||||
text="Save"
|
||||
padding="[30,30]"
|
||||
translation="[340,500]" />
|
||||
translation="[340,520]" />
|
||||
<ButtonEx
|
||||
id="closeButton"
|
||||
iconVisible="false"
|
||||
text="Close"
|
||||
padding="[30,30]"
|
||||
translation="[496,500]" />
|
||||
translation="[496,520]" />
|
||||
</Rectangle>
|
||||
</children>
|
||||
</component>
|
||||
@@ -3,7 +3,7 @@ import "pkg:/source/utils/CancellationUtils.bs"
|
||||
|
||||
@job("LatestLibVersionJob")
|
||||
function ExecuteJob() as void
|
||||
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true)
|
||||
cancellation = JobGetCancellation()
|
||||
latest = GetLatestPlayletLibVersionFromGithubReleases(cancellation)
|
||||
JobSuccessData({
|
||||
latest: latest
|
||||
|
||||
@@ -20,7 +20,7 @@ function Load() as void
|
||||
end if
|
||||
|
||||
m.bookmarksString = bookmarksString
|
||||
bookmarks = ParseJson(bookmarksString)
|
||||
bookmarks = StringUtils.ParseJsonSafe(bookmarksString)
|
||||
if bookmarks = invalid
|
||||
LogWarn("Failed to parse bookmarks json")
|
||||
return
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
import "pkg:/components/Services/Innertube/Context.bs"
|
||||
import "pkg:/source/services/HttpClient.bs"
|
||||
|
||||
namespace Innertube
|
||||
|
||||
' Some adaptive formats are tagged FORMAT_STREAM_TYPE_OTF yet are byte-range (the URL
|
||||
' carries clen/gir=yes). Fetch a bounded head of one such video and audio format and
|
||||
' report the response status, headers, and head bytes. No playback change.
|
||||
' Large enough that the head spans ftyp+moov+sidx.
|
||||
const BYTE_RANGE_PROBE_BYTES = 16383
|
||||
|
||||
function ProbeByteRangeFormats(adaptiveFormats as object, cancellation as object) as void
|
||||
if not IsArray(adaptiveFormats)
|
||||
return
|
||||
end if
|
||||
|
||||
' One video + one audio sample is enough; stop once we have both.
|
||||
videoFormat = invalid
|
||||
audioFormat = invalid
|
||||
for each format in adaptiveFormats
|
||||
if IsByteRangeMislabeledOtf(format)
|
||||
mimeType = ValidString(format.type)
|
||||
if videoFormat = invalid and mimeType.StartsWith("video")
|
||||
videoFormat = format
|
||||
else if audioFormat = invalid and mimeType.StartsWith("audio")
|
||||
audioFormat = format
|
||||
end if
|
||||
end if
|
||||
if videoFormat <> invalid and audioFormat <> invalid
|
||||
exit for
|
||||
end if
|
||||
end for
|
||||
|
||||
targets = []
|
||||
if videoFormat <> invalid
|
||||
targets.Push({ format: videoFormat, kind: "video", filePath: "tmp:/byte_range_probe_video.bin" })
|
||||
end if
|
||||
if audioFormat <> invalid
|
||||
targets.Push({ format: audioFormat, kind: "audio", filePath: "tmp:/byte_range_probe_audio.bin" })
|
||||
end if
|
||||
if targets.Count() = 0
|
||||
return
|
||||
end if
|
||||
|
||||
requestHeaders = Innertube.CreateHeaders(Innertube.ClientType.Tv)
|
||||
requestHeaders["origin"] = "https://www.youtube.com"
|
||||
requestHeaders["referer"] = "https://www.youtube.com"
|
||||
|
||||
' Launch all fetches before awaiting any, so they download in parallel.
|
||||
for each target in targets
|
||||
' Plain concat keeps the signed query intact; range is a native byte-range
|
||||
' param and bounds the download.
|
||||
url = `${target.format.url}&range=0-${BYTE_RANGE_PROBE_BYTES}&rn=0`
|
||||
request = HttpClient.Get(url)
|
||||
request.Headers(requestHeaders)
|
||||
request.ToFile(target.filePath)
|
||||
request.Cancellation(cancellation)
|
||||
request.Send()
|
||||
target.request = request
|
||||
end for
|
||||
|
||||
attachments = []
|
||||
for each target in targets
|
||||
AppendProbeReport(target, attachments)
|
||||
DeleteFile(target.filePath)
|
||||
end for
|
||||
|
||||
if CancellationUtils.IsCancelled(cancellation)
|
||||
return
|
||||
end if
|
||||
|
||||
LogTelemetryEvent({
|
||||
level: "error"
|
||||
message: "Byte-range probe for OTF-mislabeled formats"
|
||||
fingerprint: ["Byte-range probe for OTF-mislabeled formats"]
|
||||
attachments: attachments
|
||||
})
|
||||
end function
|
||||
|
||||
' OTF-tagged format that is actually byte-range: the URL carries clen (live OTF has
|
||||
' none). Restrict to fragmented mp4 audio/video.
|
||||
function IsByteRangeMislabeledOtf(format as object) as boolean
|
||||
if not IsAssociativeArray(format)
|
||||
return false
|
||||
end if
|
||||
if format.isTypeOTF <> true
|
||||
return false
|
||||
end if
|
||||
mimeType = ValidString(format.type)
|
||||
if not (mimeType.StartsWith("video/mp4") or mimeType.StartsWith("audio/mp4"))
|
||||
return false
|
||||
end if
|
||||
url = ValidString(format.url)
|
||||
return url.InStr("&clen=") <> -1 or url.InStr("?clen=") <> -1
|
||||
end function
|
||||
|
||||
function AppendProbeReport(target as object, attachments as object) as void
|
||||
format = target.format
|
||||
itag = ValidString(format.itag)
|
||||
response = target.request.Await()
|
||||
|
||||
lines = []
|
||||
lines.Push(`itag: ${itag}`)
|
||||
lines.Push(`kind: ${target.kind}`)
|
||||
lines.Push(`mimeType: ${ValidString(format.type)}`)
|
||||
lines.Push(`drm: ${IsArray(format.drmFamilies)}`)
|
||||
|
||||
if response.IsCancelled()
|
||||
lines.Push("result: cancelled")
|
||||
attachments.Push(ReportAttachment(target.kind, itag, lines))
|
||||
return
|
||||
end if
|
||||
|
||||
lines.Push(`http_status: ${response.StatusCode()}`)
|
||||
lines.Push(`headers: ${ToString(response.Headers())}`)
|
||||
|
||||
if not response.IsSuccess()
|
||||
lines.Push(`error: ${ValidString(response.ErrorMessage())}`)
|
||||
attachments.Push(ReportAttachment(target.kind, itag, lines))
|
||||
return
|
||||
end if
|
||||
|
||||
' range bounds the response, so reading the whole temp file is safe.
|
||||
head = CreateObject("roByteArray")
|
||||
head.ReadFile(target.filePath)
|
||||
fileLen = head.Count()
|
||||
lines.Push(`bytes_received: ${fileLen}`)
|
||||
if fileLen <= 0
|
||||
attachments.Push(ReportAttachment(target.kind, itag, lines))
|
||||
return
|
||||
end if
|
||||
|
||||
attachments.Push(ReportAttachment(target.kind, itag, lines))
|
||||
attachments.Push({
|
||||
filename: `byte-range-${target.kind}-${itag}.bin.hex`
|
||||
content_type: "text/plain"
|
||||
data: head.ToHexString()
|
||||
})
|
||||
end function
|
||||
|
||||
function ReportAttachment(kind as string, itag as string, lines as object) as object
|
||||
return {
|
||||
filename: `byte-range-${kind}-${itag}.txt`
|
||||
content_type: "text/plain"
|
||||
data: lines.Join(`\n`)
|
||||
}
|
||||
end function
|
||||
|
||||
end namespace
|
||||
@@ -1,25 +1,27 @@
|
||||
const PLAYLET_SUPPORT_SERVER = "https://playlet-v8556.ondigitalocean.app"
|
||||
|
||||
const VIDEO_PLAYER_USER_AGENT = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:139.0) Gecko/20100101 Firefox/139.0"
|
||||
const VIDEO_PLAYER_USER_AGENT = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:150.0) Gecko/20100101 Firefox/150.0"
|
||||
|
||||
const INNERTUBE_IOS_CLIENT_NAME = "5"
|
||||
const INNERTUBE_IOS_CLIENT_VERSION = "20.20.5"
|
||||
const INNERTUBE_IOS_CLIENT_VERSION = "21.16.2"
|
||||
const INNERTUBE_IOS_DEVICE_MODEL = "iPhone16,2"
|
||||
const INNERTUBE_IOS_OS_VERSION = "18.1"
|
||||
const INNERTUBE_IOS_USER_AGENT = "com.google.ios.youtube/20.20.5 (iPhone16,2; U; CPU iOS 18_1_0 like Mac OS X)"
|
||||
const INNERTUBE_IOS_USER_AGENT = "com.google.ios.youtube/21.16.2 (iPhone16,2; U; CPU iOS 18_1_0 like Mac OS X)"
|
||||
|
||||
const INNERTUBE_WEB_BROWSER_NAME = "Chrome"
|
||||
const INNERTUBE_WEB_BROWSER_VERSION = "140.0.0.0"
|
||||
const INNERTUBE_WEB_BROWSER_VERSION = "147.0.0.0"
|
||||
const INNERTUBE_WEB_CLIENT_NAME = "1"
|
||||
const INNERTUBE_WEB_CLIENT_VERSION = "2.20250905.01.00"
|
||||
const INNERTUBE_WEB_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0"
|
||||
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_TV_BROWSER_NAME = "SamsungBrowser"
|
||||
const INNERTUBE_TV_BROWSER_VERSION = "9.2"
|
||||
const INNERTUBE_TV_CLIENT_NAME = "2"
|
||||
const INNERTUBE_TV_CLIENT_VERSION = "7.20250902.08.00"
|
||||
const INNERTUBE_TV_CLIENT_VERSION = "7.20260611.00.00"
|
||||
const INNERTUBE_TV_DEVICE_MAKE = "Samsung"
|
||||
const INNERTUBE_TV_DEVICE_MODEL = "SmartTV"
|
||||
const INNERTUBE_TV_OS_NAME = "Tizen"
|
||||
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_CLIENT_VERSION_DOWNGRADED = "5.20260114"
|
||||
@@ -8,6 +8,7 @@ namespace Innertube
|
||||
Web = "WEB"
|
||||
IOS = "IOS"
|
||||
Tv = "TV"
|
||||
TvDowngraded = "TV_DOWNGRADED"
|
||||
end enum
|
||||
|
||||
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-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
|
||||
throw "Invalid client type"
|
||||
end if
|
||||
@@ -42,12 +51,13 @@ namespace Innertube
|
||||
|
||||
function CreateContext(client as Innertube.ClientType, deviceInfo as object, options = invalid as object) as object
|
||||
contextClient = invalid
|
||||
livingRoomPoTokenId = OptionUtils.Get(options, "livingRoomPoTokenId")
|
||||
if client = ClientType.Web
|
||||
contextClient = CreateContextClientWeb(deviceInfo)
|
||||
else if client = ClientType.IOS
|
||||
contextClient = CreateContextClientIOS(deviceInfo)
|
||||
else if client = ClientType.Tv
|
||||
contextClient = CreateContextClientTv(deviceInfo)
|
||||
else if client = ClientType.Tv or client = ClientType.TvDowngraded
|
||||
contextClient = CreateContextClientTv(deviceInfo, client, livingRoomPoTokenId)
|
||||
else
|
||||
throw "Invalid client type"
|
||||
end if
|
||||
@@ -56,8 +66,10 @@ namespace Innertube
|
||||
visitorData = OptionUtils.Get(options, "visitorData")
|
||||
onBehalfOfUser = OptionUtils.Get(options, "onBehalfOfUser")
|
||||
accessToken = OptionUtils.Get(options, "accessToken")
|
||||
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 = ClientType.Tv or client = ClientType.TvDowngraded) and IsAssociativeArray(credentialTransferToken) and not StringUtils.IsNullOrEmpty(videoId)
|
||||
|
||||
context = {
|
||||
"client": contextClient
|
||||
@@ -71,11 +83,16 @@ namespace Innertube
|
||||
}
|
||||
}
|
||||
|
||||
if not StringUtils.IsNullOrEmpty(credentialTransferToken)
|
||||
context["user"]["credentialTransferTokens"] = [{
|
||||
"token": credentialTransferToken
|
||||
"scope": "VIDEO"
|
||||
}]
|
||||
if useCtt
|
||||
cttCideoId = credentialTransferToken.videoId
|
||||
cttToken = credentialTransferToken.token
|
||||
|
||||
if not StringUtils.IsNullOrEmpty(cttToken) and videoId = cttCideoId
|
||||
context["user"]["credentialTransferTokens"] = [{
|
||||
"token": cttToken
|
||||
"scope": "VIDEO"
|
||||
}]
|
||||
end if
|
||||
end if
|
||||
|
||||
if not StringUtils.IsNullOrEmpty(visitorData) and not useAccessToken
|
||||
@@ -147,8 +164,12 @@ namespace Innertube
|
||||
}
|
||||
end function
|
||||
|
||||
function CreateContextClientTv(deviceInfo as object) as object
|
||||
return {
|
||||
function CreateContextClientTv(deviceInfo as object, client as Innertube.ClientType, livingRoomPoTokenId = "" as dynamic) as object
|
||||
tvClientVersion = INNERTUBE_TV_CLIENT_VERSION
|
||||
if client = ClientType.TvDowngraded
|
||||
tvClientVersion = INNERTUBE_TV_CLIENT_VERSION_DOWNGRADED
|
||||
end if
|
||||
contextClient = {
|
||||
"hl": GetCurrentLocale(deviceInfo)
|
||||
"gl": GetContentRegion(deviceInfo)
|
||||
"remoteHost": ""
|
||||
@@ -156,7 +177,7 @@ namespace Innertube
|
||||
"deviceModel": INNERTUBE_TV_DEVICE_MODEL
|
||||
"userAgent": INNERTUBE_TV_USER_AGENT
|
||||
"clientName": "TVHTML5"
|
||||
"clientVersion": INNERTUBE_TV_CLIENT_VERSION
|
||||
"clientVersion": tvClientVersion
|
||||
"osName": INNERTUBE_TV_OS_NAME
|
||||
"osVersion": INNERTUBE_TV_OS_VERSION
|
||||
"originalUrl": "https://www.youtube.com/tv"
|
||||
@@ -169,6 +190,10 @@ namespace Innertube
|
||||
' Separate Shorts from Subscriptions: TV_APP_QUALITY_FULL_ANIMATION
|
||||
"appQuality": "TV_APP_QUALITY_FULL_ANIMATION"
|
||||
"useStartPlaybackPreviewCommand": false
|
||||
"voiceCapability": {
|
||||
"hasSoftMicSupport": false
|
||||
"hasHardMicSupport": false
|
||||
}
|
||||
"supportsNativeScrolling": false
|
||||
}
|
||||
"browserName": INNERTUBE_TV_BROWSER_NAME
|
||||
@@ -178,7 +203,13 @@ namespace Innertube
|
||||
"screenWidthPoints": 2560
|
||||
"screenPixelDensity": 2
|
||||
"utcOffsetMinutes": -300
|
||||
"playerType": "UNIPLAYER"
|
||||
"connectionType": "CONN_CELLULAR_4G"
|
||||
}
|
||||
if not StringUtils.IsNullOrEmpty(livingRoomPoTokenId)
|
||||
contextClient.tvAppInfo["livingRoomPoTokenId"] = livingRoomPoTokenId
|
||||
end if
|
||||
return contextClient
|
||||
end function
|
||||
|
||||
function GetCurrentLocale(deviceInfo as object) as string
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
namespace Innertube
|
||||
|
||||
function CreateGetDrmLicenceRequest(options as object) as object
|
||||
videoId = OptionUtils.Get(options, "videoId")
|
||||
licenseRequest = OptionUtils.Get(options, "licenseRequest")
|
||||
drmParams = OptionUtils.Get(options, "drmParams")
|
||||
drmSessionId = OptionUtils.Get(options, "drmSessionId")
|
||||
cpn = OptionUtils.Get(options, "cpn")
|
||||
cancellation = OptionUtils.Get(options, "cancellation")
|
||||
visitorData = OptionUtils.Get(options, "visitorData")
|
||||
accessToken = OptionUtils.Get(options, "accessToken")
|
||||
|
||||
deviceInfo = CreateObject("roDeviceInfo")
|
||||
LogDebug("GetDrmInfoEx():", ToString(deviceInfo.GetDrmInfoEx()))
|
||||
|
||||
context = Innertube.CreateContext(ClientType.Tv, deviceInfo, options)
|
||||
|
||||
payload = {
|
||||
"videoId": videoId
|
||||
"context": context
|
||||
"sessionId": drmSessionId
|
||||
"cpn": cpn
|
||||
"licenseRequest": licenseRequest
|
||||
"drmParams": drmParams
|
||||
"drmSystem": "DRM_SYSTEM_WIDEVINE"
|
||||
"drmVideoFeature": "DRM_VIDEO_FEATURE_SDR"
|
||||
}
|
||||
|
||||
request = HttpClient.PostJson("https://www.youtube.com/youtubei/v1/player/get_drm_license?alt=json", payload)
|
||||
request.Headers(Innertube.CreateHeaders(ClientType.Tv))
|
||||
|
||||
if not StringUtils.IsNullOrEmpty(accessToken)
|
||||
request.Header("Authorization", "Bearer " + accessToken)
|
||||
else if not StringUtils.IsNullOrEmpty(visitorData)
|
||||
request.Header("x-goog-visitor-id", visitorData)
|
||||
end if
|
||||
|
||||
request.Cancellation(cancellation)
|
||||
return request
|
||||
end function
|
||||
|
||||
function ParseGetDrmLicenseResponse(payload as object) as dynamic
|
||||
if not IsAssociativeArray(payload)
|
||||
return {
|
||||
"error": "Invalid JSON response"
|
||||
}
|
||||
end if
|
||||
|
||||
status = ValidString(payload.status)
|
||||
if status <> "LICENSE_STATUS_OK"
|
||||
return {
|
||||
"error": "DRM license request failed with status: " + status
|
||||
}
|
||||
end if
|
||||
|
||||
license = ValidString(payload.license)
|
||||
if StringUtils.IsNullOrEmpty(license)
|
||||
return {
|
||||
"error": "DRM license is missing in the response"
|
||||
}
|
||||
end if
|
||||
|
||||
buffer = createObject("roByteArray")
|
||||
buffer.FromBase64String(license.Replace("-", "+").Replace("_", "/"))
|
||||
return buffer
|
||||
end function
|
||||
|
||||
function GenerateDrmSessionId() as string
|
||||
sessionId = ""
|
||||
for i = 0 to 15
|
||||
sessionId = sessionId + StrI(rnd(16), 16)
|
||||
end for
|
||||
return sessionId
|
||||
end function
|
||||
|
||||
end namespace
|
||||
@@ -4,28 +4,23 @@ import "pkg:/components/Services/Innertube/Constants.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
|
||||
function Init()
|
||||
m.top.observeField("requestSessionData", FuncName(OnRequestSessionData))
|
||||
end function
|
||||
|
||||
function OnNodeReady()
|
||||
OnRequestVisitorData()
|
||||
QueueSessionDataJob()
|
||||
end function
|
||||
|
||||
function OnRequestVisitorData() as void
|
||||
if m.innertubeSessionDataJob <> invalid
|
||||
function OnRequestSessionData() as void
|
||||
sessionData = m.top.sessionData
|
||||
if IsAssociativeArray(sessionData) and not StringUtils.IsNullOrEmpty(sessionData.visitorData) and not StringUtils.IsNullOrEmpty(sessionData.livingRoomPoTokenId)
|
||||
return
|
||||
end if
|
||||
|
||||
OnForceRequestVisitorData()
|
||||
QueueSessionDataJob()
|
||||
end function
|
||||
|
||||
function OnForceRequestVisitorData() as void
|
||||
if m.innertubeSessionDataJob <> invalid
|
||||
m.innertubeSessionDataJob.cancel = true
|
||||
m.innertubeSessionDataJob = invalid
|
||||
end if
|
||||
|
||||
visitorData = m.top.visitorData
|
||||
if not StringUtils.IsNullOrEmpty(visitorData)
|
||||
function QueueSessionDataJob() as void
|
||||
if m.innertubeSessionDataJob <> invalid and not m.innertubeSessionDataJob.done
|
||||
return
|
||||
end if
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
<component name="Innertube" extends="Node" includes="AutoBind">
|
||||
<interface>
|
||||
<field id="timestamp" type="int" />
|
||||
<field id="visitorData" type="string" />
|
||||
<field id="requestVisitorData" type="boolean" alwaysNotify="true" onChange="OnRequestVisitorData" />
|
||||
<field id="forceRequestVisitorData" type="boolean" alwaysNotify="true" onChange="OnForceRequestVisitorData" />
|
||||
<field id="sessionData" type="assocarray" alwaysNotify="true" />
|
||||
<field id="requestSessionData" type="boolean" alwaysNotify="true" />
|
||||
<field id="jobQueue" type="node" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -1,6 +1,7 @@
|
||||
import "pkg:/components/Services/Innertube/BrowseEndpoint.bs"
|
||||
import "pkg:/components/Services/Innertube/Constants.bs"
|
||||
import "pkg:/components/Services/Innertube/Context.bs"
|
||||
import "pkg:/components/Services/Innertube/GetDrmLicenseEndpoint.bs"
|
||||
import "pkg:/components/Services/Innertube/NextEndpoint.bs"
|
||||
import "pkg:/components/Services/Innertube/OAuth.bs"
|
||||
import "pkg:/components/Services/Innertube/PlayerEndpoint.bs"
|
||||
@@ -14,26 +15,20 @@ import "pkg:/source/utils/ObjectUtils.bs"
|
||||
import "pkg:/source/utils/OptionUtils.bs"
|
||||
import "pkg:/source/utils/TimeUtils.bs"
|
||||
|
||||
' DEBUG-only: force the SABR downgrade retry on every playable response.
|
||||
#const DEBUG_FORCE_SABR_DOWNGRADE = false
|
||||
|
||||
namespace InnertubeService
|
||||
|
||||
function GetVideoMetadata(videoId as string, options = invalid as object) as object
|
||||
options["videoId"] = videoId
|
||||
|
||||
cancellation = OptionUtils.Get(options, "cancellation")
|
||||
fetchNext = OptionUtils.GetOrDefault(options, "fetchNext", true)
|
||||
accessToken = OptionUtils.Get(options, "accessToken")
|
||||
raw = OptionUtils.GetOrDefault(options, "raw", false)
|
||||
|
||||
playerRequest = Innertube.CreatePlayerRequest(videoId, Innertube.ClientType.Tv, options)
|
||||
if not StringUtils.IsNullOrEmpty(accessToken)
|
||||
playerRequest.Header("Authorization", "Bearer " + accessToken)
|
||||
end if
|
||||
playerRequest.Cancellation(cancellation)
|
||||
if raw
|
||||
playerRequest.LogCurlCommand(true)
|
||||
end if
|
||||
playerRequest.Send()
|
||||
|
||||
nextRequest = invalid
|
||||
nextResponse = invalid
|
||||
if fetchNext
|
||||
nextRequest = Innertube.CreateNextRequest({ "videoId": videoId }, options)
|
||||
nextRequest.Cancellation(cancellation)
|
||||
@@ -43,119 +38,184 @@ namespace InnertubeService
|
||||
nextRequest.Send()
|
||||
end if
|
||||
|
||||
playerResponse = playerRequest.Await()
|
||||
if not playerResponse.IsSuccess()
|
||||
return {
|
||||
error: playerResponse.ErrorMessage()
|
||||
}
|
||||
end if
|
||||
|
||||
if CancellationUtils.IsCancelled(cancellation)
|
||||
return {
|
||||
error: "Cancelled"
|
||||
}
|
||||
end if
|
||||
|
||||
' For LIVE videos, we will need to fallback to iOS for HLS streams for now.
|
||||
' Also, since we might have tracking urls in the player response (if logged in),
|
||||
' we can keep them to avoid an extra request later.
|
||||
' TODO:P0 figure out how to get DASH to work for live videos.
|
||||
'
|
||||
' # Start of iOS fallback
|
||||
playbackTrackingUrls = invalid
|
||||
responseJson = playerResponse.Json()
|
||||
if ValidBool(ObjectUtils.Dig(responseJson, ["videoDetails", "isLive"])) or ValidBool(ObjectUtils.Dig(responseJson, ["videoDetails", "isLiveContent"]))
|
||||
LogDebug("Live video detected, falling back to iOS for HLS streams.")
|
||||
isLoggedIn = Innertube.ParseIsLoggedIn(responseJson)
|
||||
playbackTrackingUrls = Innertube.ParsePlaybackTrackingUrls(responseJson, isLoggedIn)
|
||||
|
||||
playerRequest = Innertube.CreatePlayerRequest(videoId, Innertube.ClientType.IOS, options)
|
||||
playerResponseJson = invalid
|
||||
client = Innertube.ClientType.Tv
|
||||
totalPlayerRequests = 0
|
||||
triedReloadRefresh = false
|
||||
while true
|
||||
' We shouldn't be making more than 3 requests:
|
||||
' 1. Make request with TV client.
|
||||
' 2. Make request, but STS_MISMATCH error -> retry with new STS.
|
||||
' 3. useServerDrivenAbr -> retry with downgraded TV client version to recover format URLs.
|
||||
if totalPlayerRequests >= 3
|
||||
LogError("Too many player requests, aborting.")
|
||||
return {
|
||||
error: "Too many player requests"
|
||||
}
|
||||
end if
|
||||
totalPlayerRequests += 1
|
||||
stsResult = Innertube.GetSignatureTimestamp(cancellation)
|
||||
if CancellationUtils.IsCancelled(cancellation)
|
||||
return {
|
||||
error: "Cancelled"
|
||||
}
|
||||
end if
|
||||
if stsResult.error <> invalid
|
||||
return stsResult
|
||||
end if
|
||||
options["signatureTimestamp"] = stsResult.sts
|
||||
playerRequest = Innertube.CreatePlayerRequest(client, options)
|
||||
if not StringUtils.IsNullOrEmpty(accessToken) and (client = Innertube.ClientType.Tv or client = Innertube.ClientType.TvDowngraded)
|
||||
playerRequest.Header("Authorization", "Bearer " + accessToken)
|
||||
end if
|
||||
playerRequest.Cancellation(cancellation)
|
||||
if raw
|
||||
playerRequest.LogCurlCommand(true)
|
||||
end if
|
||||
|
||||
playerResponse = playerRequest.Await()
|
||||
if not playerResponse.IsSuccess()
|
||||
return {
|
||||
error: playerResponse.ErrorMessage()
|
||||
}
|
||||
end if
|
||||
|
||||
if CancellationUtils.IsCancelled(cancellation)
|
||||
return {
|
||||
error: "Cancelled"
|
||||
}
|
||||
end if
|
||||
end if
|
||||
' # End of iOS fallback
|
||||
|
||||
if fetchNext
|
||||
nextResponse = nextRequest.Await()
|
||||
end if
|
||||
if not playerResponse.IsSuccess()
|
||||
parsedResponse = {
|
||||
error: playerResponse.ErrorMessage()
|
||||
}
|
||||
parsedResponse = AwaitAndParseNextResponse(fetchNext, raw, parsedResponse, nextRequest)
|
||||
return parsedResponse
|
||||
end if
|
||||
|
||||
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)
|
||||
LogInfo("SABR-locked response, retrying with downgraded TV client...")
|
||||
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)
|
||||
|
||||
if parsedResponse.error = invalid
|
||||
exit while
|
||||
end if
|
||||
|
||||
if parsedResponse.errorCode <> invalid
|
||||
if parsedResponse.errorCode = "STS_MISMATCH"
|
||||
LogInfo("STS_MISMATCH error, retrying...")
|
||||
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"
|
||||
useServerDrivenAbr = `${ObjectUtils.Dig(playerResponseJson, ["playerConfig", "mediaCommonConfig", "useServerDrivenAbr"])}`
|
||||
LogTelemetryEvent({
|
||||
level: "error"
|
||||
message: parsedResponse.errorCode + `\nplayerConfig.mediaCommonConfig.useServerDrivenAbr:` + useServerDrivenAbr
|
||||
fingerprint: parsedResponse.errorCode + useServerDrivenAbr
|
||||
attachments: [{
|
||||
filename: "request.txt"
|
||||
content_type: "text/plain"
|
||||
data: playerRequest.ToCurlCommand()
|
||||
}, {
|
||||
filename: "response.json"
|
||||
content_type: "application/json"
|
||||
data: playerResponse.Text()
|
||||
}]
|
||||
})
|
||||
end if
|
||||
end if
|
||||
|
||||
parsedResponse = AwaitAndParseNextResponse(fetchNext, raw, parsedResponse, nextRequest)
|
||||
return parsedResponse
|
||||
end while
|
||||
|
||||
if raw
|
||||
rawResponse = {
|
||||
"playerResponse": playerResponse.Json()
|
||||
"playerResponse": playerResponseJson
|
||||
}
|
||||
if fetchNext
|
||||
rawResponse["nextResponse"] = nextResponse.Json()
|
||||
end if
|
||||
rawResponse = AwaitAndParseNextResponse(fetchNext, raw, rawResponse, nextRequest)
|
||||
return rawResponse
|
||||
end if
|
||||
|
||||
parsedResponse = invalid
|
||||
try
|
||||
parsedResponse = Innertube.ParseInnertubePlayerResponse(playerResponse.Json(), playerRequest.signatureTimestamp, cancellation)
|
||||
catch exception
|
||||
code = ValidString(exception.code)
|
||||
if code = "STS_MISMATCH"
|
||||
return GetVideoMetadata(videoId, options)
|
||||
end if
|
||||
if code = "MISSING_FORMAT_FIELD"
|
||||
LogTelemetryEvent({
|
||||
level: "error"
|
||||
message: code
|
||||
fingerprint: code
|
||||
attachments: [{
|
||||
filename: "request.txt"
|
||||
content_type: "text/plain"
|
||||
data: playerRequest.ToCurlCommand()
|
||||
}, {
|
||||
filename: "response.json"
|
||||
content_type: "application/json"
|
||||
data: playerResponse.Text()
|
||||
}]
|
||||
})
|
||||
end if
|
||||
throw exception
|
||||
end try
|
||||
if parsedResponse.error <> invalid
|
||||
return parsedResponse
|
||||
end if
|
||||
parsedResponse = AwaitAndParseNextResponse(fetchNext, raw, parsedResponse, nextRequest)
|
||||
|
||||
if fetchNext
|
||||
if nextResponse.IsSuccess()
|
||||
parsedResponse = Innertube.ParseInnertubeNextResponse(nextResponse.Json(), parsedResponse, nextResponse)
|
||||
else
|
||||
LogWarn(nextResponse.ErrorMessage())
|
||||
end if
|
||||
end if
|
||||
|
||||
' If for some reason we missed the videoId, add it back
|
||||
if parsedResponse.error = invalid and StringUtils.IsNullOrEmpty(parsedResponse.videoId)
|
||||
if StringUtils.IsNullOrEmpty(parsedResponse.videoId)
|
||||
parsedResponse["videoId"] = videoId
|
||||
end if
|
||||
|
||||
' # Start of iOS fallback
|
||||
if playbackTrackingUrls <> invalid and parsedResponse.playbackTrackingUrls = invalid
|
||||
LogDebug("Adding playback tracking URLs from TV player response.")
|
||||
parsedResponse["playbackTrackingUrls"] = playbackTrackingUrls
|
||||
end if
|
||||
' # End of iOS fallback
|
||||
|
||||
return parsedResponse
|
||||
end function
|
||||
|
||||
' True when the TV client's response is SABR-locked: server-driven ABR signaled with no usable
|
||||
' adaptive URL.
|
||||
function IsSabrLocked(playerResponseJson as object) as boolean
|
||||
if not IsAssociativeArray(ObjectUtils.Dig(playerResponseJson, ["streamingData"]))
|
||||
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
|
||||
if not fetchNext
|
||||
return parsedResponse
|
||||
end if
|
||||
|
||||
nextResponse = nextRequest.Await()
|
||||
|
||||
if not nextResponse.IsSuccess()
|
||||
if nextResponse.IsCancelled()
|
||||
return parsedResponse
|
||||
end if
|
||||
|
||||
error = nextResponse.ErrorMessage()
|
||||
LogWarn(error)
|
||||
|
||||
if raw
|
||||
parsedResponse["nextError"] = error
|
||||
end if
|
||||
|
||||
return parsedResponse
|
||||
end if
|
||||
|
||||
if raw
|
||||
parsedResponse["nextResponse"] = nextResponse.Json()
|
||||
return parsedResponse
|
||||
end if
|
||||
|
||||
return Innertube.ParseInnertubeNextResponse(nextResponse.Json(), parsedResponse, nextResponse)
|
||||
end function
|
||||
|
||||
function GetVideoInfoBatched(videoIds as object, options = invalid as object) as object
|
||||
if not IsArray(videoIds) or videoIds.Count() = 0
|
||||
return {
|
||||
@@ -253,19 +313,15 @@ namespace InnertubeService
|
||||
disableShorts = OptionUtils.GetOrDefault(options, "disableShorts", false)
|
||||
raw = OptionUtils.GetOrDefault(options, "raw", false)
|
||||
|
||||
params = ""
|
||||
if trendingType = "music"
|
||||
' {"44:proto": {"3:string": "ytma_charts"}}
|
||||
params = "4gINGgt5dG1hX2NoYXJ0cw%3D%3D"
|
||||
else if trendingType = "gaming"
|
||||
' {"44:proto": {"3:string": "gaming_corpus_most_popular"}}
|
||||
params = "4gIcGhpnYW1pbmdfY29ycHVzX21vc3RfcG9wdWxhcg%3D%3D"
|
||||
else if trendingType = "movies"
|
||||
' {"44:proto": {"3:string": "trailers"}}
|
||||
params = "4gIKGgh0cmFpbGVycw%3D%3D"
|
||||
if trendingType = "gaming"
|
||||
browseId = "UCOpNcN46UbXVtpKMrmU4Abg" ' Gaming
|
||||
params = "Egh0cmVuZGluZw%3D%3D"
|
||||
else
|
||||
browseId = "UC4R8DWoMoI7CAwX8_LjQHig" ' Livestreams (default)
|
||||
params = "EgdsaXZldGFikgEDCKEK"
|
||||
end if
|
||||
|
||||
request = Innertube.CreateBrowseRequest("FEtrending", Innertube.ClientType.WEB, { params: params })
|
||||
request = Innertube.CreateBrowseRequest(browseId, Innertube.ClientType.Web, { params: params })
|
||||
request.Cancellation(cancellation)
|
||||
|
||||
if raw
|
||||
@@ -288,6 +344,7 @@ namespace InnertubeService
|
||||
response: response
|
||||
disableCreatorOnTheRise: true
|
||||
disableShorts: disableShorts
|
||||
browseId: browseId
|
||||
})
|
||||
|
||||
result = {
|
||||
@@ -318,12 +375,12 @@ namespace InnertubeService
|
||||
return GetBrowseAuthenticatedPage("FEplaylist_aggregation", options)
|
||||
end function
|
||||
|
||||
function GetBrowseAuthenticatedPage(browserId as string, options = invalid as object) as object
|
||||
function GetBrowseAuthenticatedPage(browseId as string, options = invalid as object) as object
|
||||
cancellation = OptionUtils.Get(options, "cancellation")
|
||||
accessToken = OptionUtils.Get(options, "accessToken")
|
||||
disableShorts = OptionUtils.GetOrDefault(options, "disableShorts", false)
|
||||
|
||||
request = Innertube.CreateBrowseRequest(browserId, Innertube.ClientType.Tv, options)
|
||||
request = Innertube.CreateBrowseRequest(browseId, Innertube.ClientType.Tv, options)
|
||||
|
||||
if accessToken <> invalid
|
||||
request.Header("Authorization", "Bearer " + accessToken)
|
||||
@@ -340,6 +397,7 @@ namespace InnertubeService
|
||||
feeds = Innertube.ParseResponseDataForFeeds(response.Json(), {
|
||||
response: response
|
||||
disableShorts: disableShorts
|
||||
browseId: browseId
|
||||
})
|
||||
|
||||
result = {
|
||||
@@ -362,7 +420,13 @@ namespace InnertubeService
|
||||
cancellation = options.cancellation
|
||||
end if
|
||||
|
||||
playerRequest = Innertube.CreatePlayerRequest(videoId, Innertube.ClientType.Tv, options)
|
||||
options["videoId"] = videoId
|
||||
stsResult = Innertube.GetSignatureTimestamp(cancellation)
|
||||
if stsResult.error <> invalid
|
||||
return stsResult
|
||||
end if
|
||||
options["signatureTimestamp"] = stsResult.sts
|
||||
playerRequest = Innertube.CreatePlayerRequest(Innertube.ClientType.Tv, options)
|
||||
playerRequest.Cancellation(cancellation)
|
||||
playerRequest.Header("Authorization", "Bearer " + accessToken)
|
||||
|
||||
@@ -375,7 +439,7 @@ namespace InnertubeService
|
||||
|
||||
json = playerResponse.Json()
|
||||
|
||||
error = Innertube.ParsePlayerResponseForError(json)
|
||||
error = Innertube.ParsePlayerResponseForError(json, playerRequest)
|
||||
if error <> ""
|
||||
return {
|
||||
error: error
|
||||
@@ -395,6 +459,7 @@ namespace InnertubeService
|
||||
cancellation = OptionUtils.Get(options, "cancellation")
|
||||
accessToken = OptionUtils.Get(options, "accessToken")
|
||||
onBehalfOfUser = OptionUtils.Get(options, "onBehalfOfUser")
|
||||
cpn = OptionUtils.Get(options, "cpn")
|
||||
|
||||
videostatsPlaybackUrl = videostatsPlaybackUrl.replace("https://s.", "https://www.")
|
||||
queryParams = UrlUtils.ParseQueryComponents(videostatsPlaybackUrl)
|
||||
@@ -402,8 +467,8 @@ namespace InnertubeService
|
||||
queryParams["cbrver"] = INNERTUBE_TV_CLIENT_VERSION
|
||||
queryParams["cver"] = INNERTUBE_TV_CLIENT_VERSION
|
||||
queryParams["ver"] = "2"
|
||||
queryParams["cpn"] = InnertubeService.CreateClientPlaybackNonce()
|
||||
queryParams["cmt"] = 0
|
||||
queryParams["cmt"] = "0"
|
||||
queryParams["cpn"] = cpn
|
||||
queryParams["final"] = "1"
|
||||
videostatsPlaybackUrl = UrlUtils.SetQueryParams(videostatsPlaybackUrl, queryParams)
|
||||
|
||||
@@ -432,6 +497,7 @@ namespace InnertubeService
|
||||
onBehalfOfUser = OptionUtils.Get(options, "onBehalfOfUser")
|
||||
|
||||
timeStr = time.ToStr("%.3f")
|
||||
cpn = OptionUtils.Get(options, "cpn")
|
||||
|
||||
videostatsWatchtimeUrl = videostatsWatchtimeUrl.replace("https://s.", "https://www.")
|
||||
queryParams = UrlUtils.ParseQueryComponents(videostatsWatchtimeUrl)
|
||||
@@ -439,11 +505,11 @@ namespace InnertubeService
|
||||
queryParams["cbrver"] = INNERTUBE_TV_CLIENT_VERSION
|
||||
queryParams["cver"] = INNERTUBE_TV_CLIENT_VERSION
|
||||
queryParams["ver"] = "2"
|
||||
queryParams["cpn"] = InnertubeService.CreateClientPlaybackNonce()
|
||||
queryParams["cmt"] = 0
|
||||
queryParams["final"] = "1"
|
||||
queryParams["cpn"] = cpn
|
||||
queryParams["cmt"] = "0"
|
||||
queryParams["st"] = timeStr
|
||||
queryParams["et"] = timeStr
|
||||
queryParams["final"] = "1"
|
||||
videostatsWatchtimeUrl = UrlUtils.SetQueryParams(videostatsWatchtimeUrl, queryParams)
|
||||
|
||||
request = HttpClient.Get(videostatsWatchtimeUrl)
|
||||
@@ -500,7 +566,7 @@ namespace InnertubeService
|
||||
return response.Json()
|
||||
end if
|
||||
|
||||
result = Innertube.ParseChannelPageResponseData(response.Json(), response)
|
||||
result = Innertube.ParseChannelPageResponseData(channelId, response.Json(), response)
|
||||
if result.authorId = invalid and result.error = invalid
|
||||
result["authorId"] = channelId
|
||||
end if
|
||||
@@ -642,7 +708,7 @@ namespace InnertubeService
|
||||
return response.Json()
|
||||
end if
|
||||
|
||||
result = Innertube.ParsePlaylistPageResponseData(response.Json(), response)
|
||||
result = Innertube.ParsePlaylistPageResponseData(playlistId, response.Json(), response)
|
||||
|
||||
if result.playlistId = invalid and result.error = invalid
|
||||
result["playlistId"] = playlistId
|
||||
@@ -753,15 +819,24 @@ namespace InnertubeService
|
||||
return false
|
||||
end function
|
||||
|
||||
function AuthRevokeAccessToken(accessToken as object, cancellation = invalid as object) as boolean
|
||||
if not IsAssociativeArray(accessToken)
|
||||
return false
|
||||
end if
|
||||
|
||||
return Innertube.RevokeAccessToken(accessToken["accessToken"], cancellation)
|
||||
function AuthRevokeToken(token as string, cancellation = invalid as object) as boolean
|
||||
return Innertube.RevokeToken(token, cancellation)
|
||||
end function
|
||||
|
||||
function AuthListAccounts(accessToken as string, cancellation = invalid as object) as object
|
||||
return Innertube.ListAccounts(accessToken, cancellation)
|
||||
end function
|
||||
|
||||
function GetDrmLicense(options as object) as dynamic
|
||||
request = Innertube.CreateGetDrmLicenceRequest(options)
|
||||
|
||||
response = request.Await()
|
||||
if not response.IsSuccess()
|
||||
return {
|
||||
error: response.ErrorMessage()
|
||||
}
|
||||
end if
|
||||
|
||||
return Innertube.ParseGetDrmLicenseResponse(response.Json())
|
||||
end function
|
||||
end namespace
|
||||
@@ -1,26 +1,55 @@
|
||||
import "pkg:/components/Services/Innertube/SessionData.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
|
||||
@job("InnertubeSessionDataJob")
|
||||
function ExecuteJob() as void
|
||||
input = JobGetInput()
|
||||
innertubeNode = JobGetInput().innertube
|
||||
|
||||
innertubeNode = input.innertube
|
||||
cached = Innertube.ReadSessionDataFromRegistry()
|
||||
cachedVisitorData = ""
|
||||
cachedLivingRoomPoTokenId = ""
|
||||
if IsAssociativeArray(cached)
|
||||
cachedVisitorData = ValidString(cached.visitorData)
|
||||
cachedLivingRoomPoTokenId = ValidString(cached.livingRoomPoTokenId)
|
||||
end if
|
||||
|
||||
cancellation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true)
|
||||
sessionData = Innertube.GetSessionData(cancellation)
|
||||
if sessionData = invalid
|
||||
JobError("Failed to fetch session data")
|
||||
' Publish the cached values immediately so playback isn't blocked while /tv is fetched.
|
||||
innertubeNode.sessionData = {
|
||||
"visitorData": cachedVisitorData
|
||||
"livingRoomPoTokenId": cachedLivingRoomPoTokenId
|
||||
}
|
||||
|
||||
fresh = Innertube.RequestTvClientData(JobGetCancellation())
|
||||
if fresh = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
innertubeNode.queueFields(true)
|
||||
if IsInt(sessionData.timestamp)
|
||||
innertubeNode.timestamp = sessionData.timestamp
|
||||
visitorData = cachedVisitorData
|
||||
timestamp = 0
|
||||
if Innertube.IsVisitorDataFresh(cached)
|
||||
visitorData = cached.visitorData
|
||||
timestamp = cached.timestamp
|
||||
else if not StringUtils.IsNullOrEmpty(fresh.visitorData)
|
||||
visitorData = fresh.visitorData
|
||||
timestamp = fresh.timestamp
|
||||
else if not StringUtils.IsNullOrEmpty(cachedVisitorData)
|
||||
visitorData = cachedVisitorData
|
||||
timestamp = cached.timestamp
|
||||
end if
|
||||
|
||||
if not StringUtils.IsNullOrEmpty(sessionData.visitorData)
|
||||
innertubeNode.visitorData = sessionData.visitorData
|
||||
livingRoomPoTokenId = cachedLivingRoomPoTokenId
|
||||
if not StringUtils.IsNullOrEmpty(fresh.livingRoomPoTokenId)
|
||||
livingRoomPoTokenId = fresh.livingRoomPoTokenId
|
||||
end if
|
||||
|
||||
innertubeNode.queueFields(false)
|
||||
Innertube.SaveSessionDataToRegistry({
|
||||
"timestamp": timestamp
|
||||
"visitorData": visitorData
|
||||
"livingRoomPoTokenId": livingRoomPoTokenId
|
||||
})
|
||||
|
||||
innertubeNode.sessionData = {
|
||||
"visitorData": visitorData
|
||||
"livingRoomPoTokenId": livingRoomPoTokenId
|
||||
}
|
||||
end function
|
||||
@@ -0,0 +1,153 @@
|
||||
import "pkg:/components/Services/Innertube/Context.bs"
|
||||
import "pkg:/source/services/HttpClient.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/utils/UrlUtils.bs"
|
||||
|
||||
' Hard ceiling for the exposed DVR window. availabilityStartTime is anchored this
|
||||
' far back at most so the player's ms-scale presentation time (now - AST) stays well
|
||||
' under INT32_MAX (~24.8 days at timescale=1000). YouTube caps live DVR at 12h.
|
||||
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 = 3
|
||||
|
||||
namespace Innertube
|
||||
|
||||
' Live streams come back with no hlsManifestUrl/dashManifestUrl, just
|
||||
' adaptiveFormats with a `targetDurationSec` and segments addressed by `&sq=N`
|
||||
' (identical to Post-Live DVR). To build a dynamic DASH manifest we need the
|
||||
' current live edge (X-Head-Seqnum) and a wall-clock anchor for the DASH
|
||||
' `availabilityStartTime`. X-Head-Time-Millis is the stream-time of the head
|
||||
' segment, so genesis = now - headTime.
|
||||
'
|
||||
' Backend-agnostic: works off the signed `adaptiveFormats[0].url` alone. The
|
||||
' innertube path passes its `client`/`cpn` (so the HEAD carries innertube
|
||||
' headers); the Invidious path passes invalid for both - the url is already
|
||||
' signed and googlevideo returns the X-Head-* headers regardless.
|
||||
function GetLiveStreamInfo(parsedResponse as object, adaptiveFormats as object, cpn as dynamic, client as dynamic, cancellation as object) as void
|
||||
if adaptiveFormats.Count() = 0
|
||||
LogWarn("GetLiveStreamInfo: No adaptive formats available")
|
||||
return
|
||||
end if
|
||||
|
||||
url = adaptiveFormats[0]["url"]
|
||||
if StringUtils.IsNullOrEmpty(url)
|
||||
LogWarn("GetLiveStreamInfo: URL is empty")
|
||||
return
|
||||
end if
|
||||
|
||||
maxDvrDurationSec = ValidInt(adaptiveFormats[0]["maxDvrDurationSec"])
|
||||
|
||||
' HEAD the base url with NO `sq`: that queries the stream's live edge and
|
||||
' returns the X-Head-* headers (X-Head-Seqnum / X-Head-Time-Sec). Pinning
|
||||
' `sq=0` instead makes googlevideo answer about segment 0 specifically, and for
|
||||
' some streams (observed targetDurationSec=5) it then omits X-Head-* entirely
|
||||
' (only X-Sequence-Num/X-Walltime-Ms) - which left availabilityStartTime unset
|
||||
' and Roku failed with "availabilityStartTime not available for live stream".
|
||||
queryComponents = UrlUtils.ParseQueryComponents(url)
|
||||
queryComponents["rn"] = "0"
|
||||
if not StringUtils.IsNullOrEmpty(cpn)
|
||||
queryComponents["cpn"] = cpn
|
||||
end if
|
||||
|
||||
url = UrlUtils.SetQueryParams(url, queryComponents)
|
||||
|
||||
request = HttpClient.Head(url)
|
||||
if client <> invalid
|
||||
requestHeaders = Innertube.CreateHeaders(client)
|
||||
else
|
||||
requestHeaders = {}
|
||||
end if
|
||||
requestHeaders["origin"] = "https://www.youtube.com"
|
||||
requestHeaders["referer"] = "https://www.youtube.com"
|
||||
requestHeaders["DNT"] = "?1"
|
||||
request.Headers(requestHeaders)
|
||||
|
||||
request.TryCount(2)
|
||||
request.Cancellation(cancellation)
|
||||
response = request.Await()
|
||||
|
||||
' Do NOT gate on HTTP status. A no-sq HEAD that queries the live edge can come
|
||||
' back non-2xx yet still carry the X-Head-* headers we need (observed: one
|
||||
' stream returns 500, another 200; both include them). Read the headers
|
||||
' regardless and only bail if they're genuinely absent (e.g. a network error
|
||||
' with no response at all).
|
||||
headers = response.Headers()
|
||||
|
||||
if not headers.DoesExist("X-Head-Seqnum")
|
||||
LogErrorNoTelemetry("[LIVE-INFO] No X-Head-Seqnum in response (HTTP " + ValidInt(response.StatusCode()).ToStr() + ")", url, headers)
|
||||
return
|
||||
end if
|
||||
headSeqnum = ValidString(headers["X-Head-Seqnum"]).ToInt()
|
||||
|
||||
' Head time: NEVER parse X-Head-Time-Millis with .ToInt(). For a long-running
|
||||
' 24/7 stream (e.g. 76 days = 6.58e9 ms) it overflows BrightScript's 32-bit
|
||||
' int, corrupting both the genesis anchor AND the derived fragment duration
|
||||
' (seen as a bogus 327ms vs the real 1000ms). Prefer X-Head-Time-Sec
|
||||
' (~6.58e6, fits int32, equals X-Head-Seqnum here at 1 fragment/second); if
|
||||
' only millis is present, ParseJson decodes it as a 64-bit double untruncated.
|
||||
if headers.DoesExist("X-Head-Time-Sec")
|
||||
headTimeSec = ValidString(headers["X-Head-Time-Sec"]).ToInt()
|
||||
else if headers.DoesExist("X-Head-Time-Millis")
|
||||
headTimeSec = Cint(StringUtils.ParseJsonSafe(ValidString(headers["X-Head-Time-Millis"])) / 1000.0)
|
||||
else
|
||||
LogErrorNoTelemetry("[LIVE-INFO] Missing X-Head-Time-Sec / -Millis in headers", url, headers)
|
||||
return
|
||||
end if
|
||||
nowSec = CreateObject("roDateTime").AsSeconds()
|
||||
|
||||
' Anchor availabilityStartTime to the DVR window, NOT the true stream genesis.
|
||||
' A 24/7 channel can be live for weeks; with timescale=1000 the player's
|
||||
' (now - availabilityStartTime) presentation time in ms then exceeds INT32_MAX
|
||||
' (~24.8 days) and the live-edge segment math wraps - the playhead falls back
|
||||
' near the period start, hours/days behind real time. Segments older than the
|
||||
' DVR window 404 anyway, so the window IS the real availability start.
|
||||
' DashManifest shifts startNumber to match this anchor.
|
||||
windowSec = maxDvrDurationSec
|
||||
if windowSec <= 0 or windowSec > LIVE_MAX_DVR_WINDOW_SEC
|
||||
windowSec = LIVE_MAX_DVR_WINDOW_SEC
|
||||
end if
|
||||
' A young stream has less history than the DVR window.
|
||||
if headTimeSec > 0 and windowSec > headTimeSec
|
||||
windowSec = headTimeSec
|
||||
end if
|
||||
|
||||
' Effective per-fragment duration, derived from the stream's own counters.
|
||||
' YouTube's reported targetDurationSec is unreliable for long-running streams
|
||||
' (observed 5s vs a real ~1.8s cadence); using it desyncs the duration-based
|
||||
' SegmentTemplate so the player requests segments far outside the DVR window
|
||||
' (404). headTime/headSeqnum is the true average and keeps the manifest's
|
||||
' wall-clock -> sq mapping anchored to the same (headTime, headSeqnum) pair
|
||||
' that availabilityStartTime is built from.
|
||||
fragmentDurationMs = 0
|
||||
if headSeqnum > 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 function
|
||||
|
||||
end namespace
|
||||