Skip to content

Commit 69a5a66

Browse files
authored
fix(vidstack): allow casting dash sources (#1814)
1 parent 68674f8 commit 69a5a66

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { canGoogleCastSrc } from './mime';
2+
3+
describe(canGoogleCastSrc.name, function () {
4+
it('accepts DASH sources by type', function () {
5+
expect(
6+
canGoogleCastSrc({
7+
src: 'https://example.com/manifest',
8+
type: 'application/dash+xml',
9+
}),
10+
).to.equal(true);
11+
});
12+
13+
it('accepts DASH sources by extension', function () {
14+
expect(
15+
canGoogleCastSrc({
16+
src: 'https://example.com/manifest.mpd',
17+
type: '',
18+
}),
19+
).to.equal(true);
20+
});
21+
});

packages/vidstack/src/utils/mime.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ export function isDASHSrc({ src, type }: Src): boolean {
8181
}
8282

8383
export function canGoogleCastSrc(src: Src): boolean {
84-
return isString(src.src) && (isAudioSrc(src) || isVideoSrc(src) || isHLSSrc(src));
84+
return (
85+
isString(src.src) && (isAudioSrc(src) || isVideoSrc(src) || isHLSSrc(src) || isDASHSrc(src))
86+
);
8587
}
8688

8789
export function isMediaStream(src: unknown): src is MediaStream {

0 commit comments

Comments
 (0)