Elm-Media-Source: Better sources for audio & video, supports HTML5 Media Fragments API

Happy Passover, Happy Easter, Happy weekend.

I’ve worked hard on one part of the media API that can be created in pure elm right now: The Media Fragments API. Find it on Elm Packages here.

The Media Fragments API???

What’s that? You’ve never heard of the Media Fragments API?

Well, I’m not surprised, but it is a bit of a shame, because Media Fragments has the potential to be awesome, if it were used more (come on browser-makers, implement this stuff). The spec lets you specify chapter maker to jump to in a media file, allows you to specify which audio tracks to load in a multitrack file, and lets you specify short start and end times in a clip, like if you just want to pull out a specific joke when linking to a favor part of a move.

Unfortunately, cross-browser support is iffy at best, and I’m going to have to start up a crowd-sourced testing regime, including making some video files that will support these advanced features.

But for now, if you are using these features, you can use them in Elm.

Better source elements

Elm-lang/html does a perfectly fine job wrapping the element, but it very much just replicates the element.

Along the way to creating a fragments implementation, I realized I could use the same technique to improve on this.

I want to stress two things:

  1. At least until you start working with media capture, media source elements, or web audio, every source tag should have a url string. My source function compels.

  2. You should be offering media in different file formats, to strike a balance between compatibility and efficiency. Send each user the most efficient file their browser can decode. This package makes it easy to specify mime types and codecs.

Next Steps

First, I definitely want/need to start a testing regime around what each browser supports in terms of the media. This is an area where cross-browser support is particularly rough…

Second, I’d like to work to develop more defaults, so that developers don’t have to go look up that H264 High-Profile codec is identified as “avc1.64001E.”


Would love feedback, as always. Thanks.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.