mirror of
https://github.com/movie-web/movie-web.git
synced 2024-11-11 01:55:05 +01:00
Suggested changes
This commit is contained in:
parent
fac2b50bfc
commit
54d1af0e0a
@ -88,7 +88,21 @@ export function createCastingStateProvider(
|
||||
// no picture in picture while casting
|
||||
},
|
||||
setPlaybackSpeed(num) {
|
||||
this.setPlaybackSpeed(num);
|
||||
const mediaInfo = new chrome.cast.media.MediaInfo(
|
||||
state.meta?.meta.meta.id ?? "video",
|
||||
"video/mp4"
|
||||
);
|
||||
(mediaInfo as any).contentUrl = state.source?.url;
|
||||
mediaInfo.streamType = chrome.cast.media.StreamType.BUFFERED;
|
||||
mediaInfo.metadata = new chrome.cast.media.MovieMediaMetadata();
|
||||
mediaInfo.metadata.title = state.meta?.meta.meta.title ?? "";
|
||||
mediaInfo.customData = {
|
||||
playbackRate: num,
|
||||
};
|
||||
const request = new chrome.cast.media.LoadRequest(mediaInfo);
|
||||
request.autoplay = true;
|
||||
const session = ins?.getCurrentSession();
|
||||
session?.loadMedia(request);
|
||||
},
|
||||
async setVolume(v) {
|
||||
// clamp time between 0 and 1
|
||||
@ -117,7 +131,7 @@ export function createCastingStateProvider(
|
||||
movieMeta.title = state.meta?.meta.meta.title ?? "";
|
||||
|
||||
const mediaInfo = new chrome.cast.media.MediaInfo(
|
||||
state.meta?.meta.meta.id ?? "hello",
|
||||
state.meta?.meta.meta.id ?? "video",
|
||||
"video/mp4"
|
||||
);
|
||||
(mediaInfo as any).contentUrl = source?.source;
|
||||
|
@ -280,6 +280,10 @@ export function createVideoStateProvider(
|
||||
state.mediaPlaying.isLoading = false;
|
||||
updateMediaPlaying(descriptor, state);
|
||||
};
|
||||
const ratechange = () => {
|
||||
state.mediaPlaying.playbackSpeed = player.playbackRate;
|
||||
updateMediaPlaying(descriptor, state);
|
||||
};
|
||||
const fullscreenchange = () => {
|
||||
state.interface.isFullscreen = !!document.fullscreenElement;
|
||||
updateInterface(descriptor, state);
|
||||
@ -328,6 +332,7 @@ export function createVideoStateProvider(
|
||||
player.addEventListener("timeupdate", timeupdate);
|
||||
player.addEventListener("loadedmetadata", loadedmetadata);
|
||||
player.addEventListener("canplay", canplay);
|
||||
player.addEventListener("ratechange", ratechange);
|
||||
fscreen.addEventListener("fullscreenchange", fullscreenchange);
|
||||
player.addEventListener("error", error);
|
||||
player.addEventListener(
|
||||
|
Loading…
Reference in New Issue
Block a user