This commit is contained in:
buttertop 2026-07-05 22:59:32 +07:00 committed by GitHub
commit f25b8d8df0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -30,6 +30,7 @@ server {
alias /youtube/;
types {
video/mp4 mp4;
text/vtt vtt;
}
}

View File

@ -165,7 +165,7 @@ const GoogleCast = ({ video, setRefresh, onWatchStateChanged }: GoogleCastProps)
for (let i = 0; i < videoSubtitles.length; i++) {
const subtitle = new chrome.cast.media.Track(i, chrome.cast.media.TrackType.TEXT);
subtitle.trackContentId = videoSubtitles[i].media_url;
subtitle.trackContentId = `${getURL()}${videoSubtitles[i].media_url}`;
subtitle.trackContentType = 'text/vtt';
subtitle.subtype = chrome.cast.media.TextTrackType.SUBTITLES;
subtitle.name = videoSubtitles[i].name;
@ -188,6 +188,9 @@ const GoogleCast = ({ video, setRefresh, onWatchStateChanged }: GoogleCastProps)
// request.queueData = new chrome.cast.media.QueueData(); // See https://developers.google.com/cast/docs/reference/web_sender/chrome.cast.media.QueueData for playlist support.
request.currentTime = shiftCurrentTime(video?.player?.position); // Set video start position based on the browser video position
// request.activeTrackIds = contentActiveSubtitle; // Set active subtitle based on video player
if (contentSubtitles.length > 0) {
request.activeTrackIds = [0];
}
castSession.loadMedia(request).then(
function () {