Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions packages/castable-video/castable-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
currentSession,
getDefaultCastOptions,
isHls,
getPlaylistSegmentFormat
getPlaylistSegmentFormat,
} from './castable-utils.js';

/**
Expand All @@ -21,7 +21,6 @@ import {
*/
export const CastableMediaMixin = (superclass) =>
class CastableMedia extends superclass {

static observedAttributes = [
...(superclass.observedAttributes ?? []),
'cast-src',
Expand Down Expand Up @@ -50,7 +49,7 @@ export const CastableMediaMixin = (superclass) =>
}

privateProps.set(this, {
loadOnPrompt: () => this.#loadOnPrompt()
loadOnPrompt: () => this.#loadOnPrompt(),
});

return (this.#remote = new RemotePlayback(this));
Expand Down Expand Up @@ -126,10 +125,7 @@ export const CastableMediaMixin = (superclass) =>
activeTrackIds.push(trackId);
}

const track = new chrome.cast.media.Track(
trackId,
chrome.cast.media.TrackType.TEXT
);
const track = new chrome.cast.media.Track(trackId, chrome.cast.media.TrackType.TEXT);
track.trackContentId = trackEl.src;
track.trackContentType = 'text/vtt';
track.subtype =
Expand Down Expand Up @@ -159,7 +155,8 @@ export const CastableMediaMixin = (superclass) =>
}
const { videoFormat, audioFormat } = await getPlaylistSegmentFormat(this.castSrc);

const isVideoFMP4 = videoFormat?.includes('m4s') || videoFormat?.includes('mp4') || videoFormat?.includes('m4a');
const isVideoFMP4 =
videoFormat?.includes('m4s') || videoFormat?.includes('mp4') || videoFormat?.includes('m4a');
if (isVideoFMP4) {
mediaInfo.hlsSegmentFormat = chrome.cast.media.HlsSegmentFormat.FMP4;
mediaInfo.hlsVideoSegmentFormat = chrome.cast.media.HlsVideoSegmentFormat.FMP4;
Expand Down Expand Up @@ -237,7 +234,8 @@ export const CastableMediaMixin = (superclass) =>
this.getAttribute('cast-src') ??
this.querySelector('source')?.src ??
resolvedSrc ??
this.getAttribute('src') ?? undefined
this.getAttribute('src') ??
undefined
);
}

Expand Down Expand Up @@ -303,10 +301,7 @@ export const CastableMediaMixin = (superclass) =>

set muted(val) {
if (this.#castPlayer) {
if (
(val && !this.#castPlayer.isMuted) ||
(!val && this.#castPlayer.isMuted)
) {
if ((val && !this.#castPlayer.isMuted) || (!val && this.#castPlayer.isMuted)) {
this.#castPlayer.controller?.muteOrUnmute();
}
return;
Expand Down
Loading