diff --git a/curriculum/challenges/english/blocks/lab-html-audio-and-video-player/68de40f53fcaf106f51cc20f.md b/curriculum/challenges/english/blocks/lab-html-audio-and-video-player/68de40f53fcaf106f51cc20f.md index ea966be06b1..d9c8388b2d5 100644 --- a/curriculum/challenges/english/blocks/lab-html-audio-and-video-player/68de40f53fcaf106f51cc20f.md +++ b/curriculum/challenges/english/blocks/lab-html-audio-and-video-player/68de40f53fcaf106f51cc20f.md @@ -112,6 +112,25 @@ const typeAttr = source.getAttribute('type'); assert.isNotEmpty(typeAttr); ``` +The `type` attribute should match the media type of the file extension of the `src` attribute. + +```js +const section = document.querySelector('section'); +const source = section?.querySelector('h2 + video > source'); +const typeAttr = source.getAttribute('type'); +const srcAttr = source.getAttribute('src'); +const srcFileExt = srcAttr.match(/[^\.]+$/g)[0]; +const fileExtToMediaTypes = { + mp4: ['video/mp4'], + webm: ['video/webm'], + ogg: ['video/ogg'], + avi: ['video/avi', 'video/vnd.avi', 'video/msvideo', 'video/x-msvideo'], + mov: ['video/quicktime'] +}; +const srcMediaTypes = fileExtToMediaTypes[srcFileExt]; +assert.oneOf(typeAttr, srcMediaTypes); +``` + Inside the second `section` element, you should have an `h2` element for the title of the song playing. ```js