Skip to content

Commit

Permalink
only set disableRemotePlayback if it's defined by the browser
Browse files Browse the repository at this point in the history
  • Loading branch information
Florent-Bouisset committed Nov 6, 2024
1 parent e2e3399 commit 6571e83
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/core/stream/representation/representation_stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export default function RepresentationStream<TSegmentDataType>(
const canStream = new SharedReference<boolean>(true);

playbackObserver.listen((observation) => {
const observationCanStream = observation.canStream ?? true
const observationCanStream = observation.canStream ?? true;
if (canStream.getValue() !== observationCanStream) {
log.debug("Stream: observation.canStream updated to", observationCanStream);
canStream.setValue(observationCanStream);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default function prepareSourceBuffer(
resetMediaElement(videoElement, objectURL);
});
}
if (isManagedMediaSource) {
if (isManagedMediaSource && "disableRemotePlayback" in videoElement) {
const disableRemotePlaybackPreviousValue = videoElement.disableRemotePlayback;
cleanUpSignal.register(() => {
/**
Expand All @@ -78,7 +78,6 @@ export default function prepareSourceBuffer(
* by the application before calling the RxPlayer.
*/
if (
"disableRemotePlayback" in videoElement &&
disableRemotePlaybackPreviousValue !== undefined
) {
videoElement.disableRemotePlayback = disableRemotePlaybackPreviousValue;
Expand Down
3 changes: 1 addition & 2 deletions src/main_thread/init/multi_thread_content_initializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1814,7 +1814,7 @@ export default class MultiThreadContentInitializer extends ContentInitializer {
});
mediaSourceStatus.setValue(MediaSourceInitializationStatus.Attached);

if (isManagedMediaSource) {
if (isManagedMediaSource && "disableRemotePlayback" in mediaElement) {
const disableRemotePlaybackPreviousValue =
mediaElement.disableRemotePlayback;
this._currentMediaSourceCanceller.signal.register(() => {
Expand All @@ -1824,7 +1824,6 @@ export default class MultiThreadContentInitializer extends ContentInitializer {
* before calling the RxPlayer.
*/
if (
"disableRemotePlayback" in mediaElement &&
disableRemotePlaybackPreviousValue !== undefined
) {
mediaElement.disableRemotePlayback =
Expand Down
3 changes: 1 addition & 2 deletions src/main_thread/init/utils/create_media_source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function createMediaSource(
resetMediaElement(mediaElement, oldSrc);
const mediaSource = new MainMediaSourceInterface(generateMediaSourceId());

if (isManagedMediaSource) {
if (isManagedMediaSource && "disableRemotePlayback" in mediaElement) {
const disableRemotePlaybackPreviousValue = mediaElement.disableRemotePlayback;
unlinkSignal.register(() => {
/**
Expand All @@ -89,7 +89,6 @@ function createMediaSource(
* by the application before calling the RxPlayer.
*/
if (
"disableRemotePlayback" in mediaElement &&
disableRemotePlaybackPreviousValue !== undefined
) {
mediaElement.disableRemotePlayback = disableRemotePlaybackPreviousValue;
Expand Down

0 comments on commit 6571e83

Please sign in to comment.