Skip to content

Commit

Permalink
revert(player): show message when no cast devices
Browse files Browse the repository at this point in the history
  • Loading branch information
mihar-22 committed Mar 31, 2024
1 parent 1fd57f0 commit c7934a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 22 deletions.
13 changes: 0 additions & 13 deletions packages/vidstack/player/styles/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,3 @@ iframe.vds-youtube[data-no-controls] {
.vds-google-cast-info {
font-size: calc(var(--media-height) / 100 * 6);
}

.vds-toast {
background-color: #1a1a1a;
border-radius: 0.375rem;
top: 1rem;
color: white;
font-size: 1rem;
left: 50%;
padding: 1rem;
position: fixed;
translate: -50% 0%;
z-index: 999999;
}
14 changes: 5 additions & 9 deletions packages/vidstack/src/providers/google-cast/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type { DOMEvent } from 'maverick.js/std';

import type { MediaType, Src } from '../../core';
import type { MediaContext } from '../../core/api/media-context';
import { showToast } from '../../utils/dom';
import { canGoogleCastSrc } from '../../utils/mime';
import { loadScript } from '../../utils/network';
import { IS_CHROME, IS_IOS } from '../../utils/support';
Expand Down Expand Up @@ -53,10 +52,11 @@ export class GoogleCastLoader implements MediaProviderLoader<GoogleCastProvider>
try {
loadEvent = await this._loadCastFramework(ctx);

const State = window.cast.framework.CastState;
if (this.cast.getCastState() === State.NO_DEVICES_AVAILABLE) {
throw this._createError(State.NO_DEVICES_AVAILABLE, 'No cast devices found.');
}
// Not working as expected.
// const State = window.cast.framework.CastState;
// if (this.cast.getCastState() === State.NO_DEVICES_AVAILABLE) {
// throw this._createError(State.NO_DEVICES_AVAILABLE, 'No cast devices found.');
// }

if (!this._player) {
this._player = new cast.framework.RemotePlayer();
Expand Down Expand Up @@ -95,10 +95,6 @@ export class GoogleCastLoader implements MediaProviderLoader<GoogleCastProvider>

ctx.player.dispatch(errorEvent);

if (!errorEvent.defaultPrevented && error.code === 'NO_DEVICES_AVAILABLE') {
showToast('No cast devices found.');
}

this._notifyRemoteStateChange(
ctx,
isCastConnected() ? 'connected' : 'disconnected',
Expand Down

0 comments on commit c7934a9

Please sign in to comment.