From 8456b6a1251b10d2cb6d5baaccf83ec713e0acae Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Thu, 15 Nov 2018 22:52:04 -0800 Subject: [PATCH] Implement #767 for custom media only --- docs/custom-media.md | 5 ++++- src/custom-media.js | 3 +-- test/custom-media.js | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/custom-media.md b/docs/custom-media.md index ee460d8f..af23b7c3 100644 --- a/docs/custom-media.md +++ b/docs/custom-media.md @@ -71,8 +71,11 @@ The following MIME types are accepted for the `contentType` field: * `video/webm` * `video/ogg` * `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. + * `application/dash+xml` (DASH streams) + - Support for DASH is experimental * ~~`rtmp/flv`~~ - In light of Adobe phasing out support for Flash, and many browsers already dropping support, RTMP is not supported by this feature. diff --git a/src/custom-media.js b/src/custom-media.js index d3c872d0..6795e257 100644 --- a/src/custom-media.js +++ b/src/custom-media.js @@ -30,8 +30,7 @@ const SOURCE_CONTENT_TYPES = new Set([ ]); const LIVE_ONLY_CONTENT_TYPES = new Set([ - 'application/dash+xml', - 'application/x-mpegURL' + 'application/dash+xml' ]); export function lookup(url, opts) { diff --git a/test/custom-media.js b/test/custom-media.js index 96922432..4bbca818 100644 --- a/test/custom-media.js +++ b/test/custom-media.js @@ -90,13 +90,13 @@ describe('custom-media', () => { assert.throws(() => validate(invalid), /URL protocol must be HTTPS/); }); - it('rejects non-live HLS', () => { + it('rejects non-live DASH', () => { invalid.live = false; - invalid.sources[0].contentType = 'application/x-mpegURL'; + invalid.sources[0].contentType = 'application/dash+xml'; assert.throws( () => validate(invalid), - /contentType "application\/x-mpegURL" requires live: true/ + /contentType "application\/dash\+xml" requires live: true/ ); }); });