In HTML5 video and via JW Player it is possible to have multiple sources for different codecs and resolutions. This module should support this capability. Also see levels: http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/15....
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 1401342-multiple-formats.diff | 7.18 KB | rickvug |
| #4 | 1401342-multiple-formats-wip.diff | 3.93 KB | rickvug |
Comments
Comment #1
rickvug commentedMarked #1409216: Levels as a duplicate. Wanting to support multiple resolutions/bit rates is fundamentally tied to having more than a single source for a video.
Comment #2
rickvug commentedI'd certainly like to support multiple video resolutions and codecs. It hasn't been done due to time and because I have no current need for the functionality. I'd be up for reviewing and potentially committing a patch at this point.
For implementation what I'm thinking is that sources becomes an array that is passed to the theme function. The theme function would then process the array into a $sources variable that is passed to the template file and also add to the JW Player config variable. Because most people will only ever pass a file object to the theme function perhaps this could be an additional option for advanced users (choose one or the other).
Something to work out is the expected format of the array itself. According to the JW Player documentation levels can be used for multiple bit rates, which requires additional parameters for width and bitrate, or for multiple codecs, which only requires the video URL. Here is what the array for the multiple formats would look like:
And for variable bit rates:
Another potential option to unify this would be to make the video path the key, with the bitrate and width an array of optional values:
One scenario that the JW Player documentation doesn't account for is multiple bit rates in multiple formats. I'm not sure if that is even possible. Any thoughts on the structure of the array are welcome.
Comment #3
webkenny commentedSeems like this could be part of a larger implementation. Should be easy enough to build the entire array needed to pass to the .setup() function in PHP and return it as JSON for the JW Player. I'm going to have a requirement to do some of this fanciness so let me see if I can cook up something for it. I do like the simple pass these or pass just this approach so it fits both user levels of experience.
Comment #4
rickvug commentedAttached is some work in progress towards this goal. It replaces the file_url and file_mime variables with a new sources variable that is an array of file_url and file_mime pairs. It seems to work fine to support multiple video formats. I've yet to start working on the bitrate switching problem. Feedback appreciated!
Comment #5
rickvug commentedAttached is an update patch that also works with adaptive bitrates. Some minor documentation changes snuck into the patch as well. Here's the theme call I've been using to test (replace 'my_sites_preset' with a preset from your test site):
I'm tempted to commit this work now as it is needed for one of my own projects but getting some feedback first would be ideal.
Comment #6
rickvug commentedI ended up committing the changes as this was needed for a project I'm working on. Feedback and changes are still welcome. I'll be waiting a little bit before creating a new release with the change.
Comment #8
fugazi commentedThere are already new understanding on this subject, I am very interested in this, but how can I put it into Drupal. I point to multi-field around video. Had then but many videos with each other.
I write purely the bitrate. For me it is still very complicated.
Comment #9
rickvug commented@fugazi You're right that better support for multiple videos in a single field should be added. I've created #1555960: Expose multiple file support to field formatter for the request.
Comment #10
natefollmer commentedI'm trying to get your code from #5 working, but I'm a bit of a noob... Where do I put this code? I tried putting it in my node with the PHP text filter on, but that didn't work out so well.
I also tried using Code Per Node and inserting the levels javascript from the JWPlayer site, it does size my div accordingly, but the player or video never loads.
Comment #11
najibx commented1. multiple videos (in different codec) are uploaded into different filefield?
2. how are there multiple files, see as "level" instead of one. What do we do with each video upload filefield formatter?
Comment #11.0
najibx commentedAdding note about supporting levels, which was requested in http://drupal.org/node/1409216.