MCPcopy
hub / github.com/ocsjs/ocsjs / watchMedia

Function watchMedia

packages/scripts/src/projects/icourse.ts:640–664  ·  view source on GitHub ↗
(playbackRate: number, volume: number)

Source from the content-addressed store, hash-verified

638}
639
640async function watchMedia(playbackRate: number, volume: number) {
641 return new Promise<void>((resolve, reject) => {
642 // 部分用户视频加载很慢,这里等待一下
643 waitForMedia()
644 .then((video) => {
645 video.playbackRate = playbackRate;
646 video.volume = volume;
647
648 state.currentMedia = video;
649
650 playMedia(() => video?.play());
651
652 video.onpause = async () => {
653 if (!video?.ended) {
654 video?.play();
655 }
656 };
657
658 video.onended = () => {
659 resolve();
660 };
661 })
662 .catch(reject);
663 });
664}
665
666async function readPPT(remotePage: RemotePage, readSpeed: number) {
667 const reader = document.querySelector('.ux-pdf-reader');

Callers 1

studyFunction · 0.70

Calls 2

waitForMediaFunction · 0.90
playMediaFunction · 0.90

Tested by

no test coverage detected