mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-08 08:39:59 +00:00
Use cast export module for enum values instead of direct imports
This commit is contained in:
@@ -4,9 +4,9 @@ import options from "../../lib/options";
|
|||||||
import type { Message } from "../../messaging";
|
import type { Message } from "../../messaging";
|
||||||
|
|
||||||
// Cast types
|
// Cast types
|
||||||
import { Capability, ReceiverAvailability } from "../sdk/enums";
|
import type { ReceiverAvailability } from "../sdk/enums";
|
||||||
import { Media, PlayerState } from "../sdk/media";
|
|
||||||
import type Session from "../sdk/Session";
|
import type Session from "../sdk/Session";
|
||||||
|
import type Media from "../sdk/media/Media";
|
||||||
|
|
||||||
import cast, { ensureInit, CastPort } from "../export";
|
import cast, { ensureInit, CastPort } from "../export";
|
||||||
|
|
||||||
@@ -73,9 +73,9 @@ export default class MediaSender {
|
|||||||
throw logger.error("Local media casting not enabled");
|
throw logger.error("Local media casting not enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
const capabilities = [Capability.AUDIO_OUT];
|
const capabilities = [cast.Capability.AUDIO_OUT];
|
||||||
if (this.mediaElement instanceof HTMLVideoElement) {
|
if (this.mediaElement instanceof HTMLVideoElement) {
|
||||||
capabilities.push(Capability.VIDEO_OUT);
|
capabilities.push(cast.Capability.VIDEO_OUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
cast.initialize(
|
cast.initialize(
|
||||||
@@ -280,17 +280,17 @@ export default class MediaSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const mediaElementPlayerState = mediaElement.paused
|
const mediaElementPlayerState = mediaElement.paused
|
||||||
? PlayerState.PAUSED
|
? cast.media.PlayerState.PAUSED
|
||||||
: PlayerState.PLAYING;
|
: cast.media.PlayerState.PLAYING;
|
||||||
|
|
||||||
if (mediaElementPlayerState !== this.media.playerState) {
|
if (mediaElementPlayerState !== this.media.playerState) {
|
||||||
switch (this.media.playerState) {
|
switch (this.media.playerState) {
|
||||||
case PlayerState.PLAYING:
|
case cast.media.PlayerState.PLAYING:
|
||||||
mediaElement.play();
|
mediaElement.play();
|
||||||
break;
|
break;
|
||||||
case PlayerState.PAUSED:
|
case cast.media.PlayerState.PAUSED:
|
||||||
case PlayerState.BUFFERING:
|
case cast.media.PlayerState.BUFFERING:
|
||||||
case PlayerState.IDLE:
|
case cast.media.PlayerState.IDLE:
|
||||||
mediaElement.pause();
|
mediaElement.pause();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user