Skip to content

Commit

Permalink
fix(player): source objects failing provider loader checks
Browse files Browse the repository at this point in the history
closes #1147
  • Loading branch information
mihar-22 committed Feb 6, 2024
1 parent c583cf0 commit d243793
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion packages/vidstack/src/providers/audio/loader.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { isString } from 'maverick.js/std';

import type { MediaSrc, MediaType } from '../../core';
import type { MediaContext } from '../../core/api/media-context';
import { isAudioSrc } from '../../utils/mime';
Expand All @@ -14,7 +16,12 @@ export class AudioProviderLoader implements MediaProviderLoader<AudioProvider> {
if (!isAudioSrc(src)) return false;
// Let this pass through on the server, we can figure out which type to play client-side. The
// important thing is that the correct provider is loaded.
return __SERVER__ || src.type === '?' || canPlayAudioType(this.target, src.type);
return (
__SERVER__ ||
!isString(src.src) ||
src.type === '?' ||
canPlayAudioType(this.target, src.type)
);
}

mediaType(): MediaType {
Expand Down
9 changes: 8 additions & 1 deletion packages/vidstack/src/providers/video/loader.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { isString } from 'maverick.js/std';

import type { MediaSrc, MediaType } from '../../core';
import type { MediaContext } from '../../core/api/media-context';
import { isVideoSrc } from '../../utils/mime';
Expand All @@ -14,7 +16,12 @@ export class VideoProviderLoader implements MediaProviderLoader<VideoProvider> {
if (!isVideoSrc(src)) return false;
// Let this pass through on the server, we can figure out which type to play client-side. The
// important thing is that the correct provider is loaded.
return __SERVER__ || src.type === '?' || canPlayVideoType(this.target, src.type);
return (
__SERVER__ ||
!isString(src.src) ||
src.type === '?' ||
canPlayVideoType(this.target, src.type)
);
}

mediaType(): MediaType {
Expand Down

0 comments on commit d243793

Please sign in to comment.