Implement #767 for custom media only

This commit is contained in:
Calvin Montgomery 2018-11-15 22:52:04 -08:00
parent 027b27c1b0
commit 8456b6a125
3 changed files with 8 additions and 6 deletions

View file

@ -71,8 +71,11 @@ The following MIME types are accepted for the `contentType` field:
* `video/webm` * `video/webm`
* `video/ogg` * `video/ogg`
* `application/x-mpegURL` (HLS streams) * `application/x-mpegURL` (HLS streams)
- HLS is only supported for livestreams. Metadata with HLS sources - HLS is only tested with livestreams. VODs are accepted, but I do not test
this functionality.
but without `live: true` will be rejected. but without `live: true` will be rejected.
* `application/dash+xml` (DASH streams)
- Support for DASH is experimental
* ~~`rtmp/flv`~~ * ~~`rtmp/flv`~~
- In light of Adobe phasing out support for Flash, and many browsers - In light of Adobe phasing out support for Flash, and many browsers
already dropping support, RTMP is not supported by this feature. already dropping support, RTMP is not supported by this feature.

View file

@ -30,8 +30,7 @@ const SOURCE_CONTENT_TYPES = new Set([
]); ]);
const LIVE_ONLY_CONTENT_TYPES = new Set([ const LIVE_ONLY_CONTENT_TYPES = new Set([
'application/dash+xml', 'application/dash+xml'
'application/x-mpegURL'
]); ]);
export function lookup(url, opts) { export function lookup(url, opts) {

View file

@ -90,13 +90,13 @@ describe('custom-media', () => {
assert.throws(() => validate(invalid), /URL protocol must be HTTPS/); assert.throws(() => validate(invalid), /URL protocol must be HTTPS/);
}); });
it('rejects non-live HLS', () => { it('rejects non-live DASH', () => {
invalid.live = false; invalid.live = false;
invalid.sources[0].contentType = 'application/x-mpegURL'; invalid.sources[0].contentType = 'application/dash+xml';
assert.throws( assert.throws(
() => validate(invalid), () => validate(invalid),
/contentType "application\/x-mpegURL" requires live: true/ /contentType "application\/dash\+xml" requires live: true/
); );
}); });
}); });