Search code examples
javascriptflashmp4jwplayerflv

Convert JWPlayer 5 to JWPlayer 6 flash(flv) and HTML(mp4) format videos


I want to make that everybody would watch flash(flv) format expect if they don't have flash they would see html5(mp4/m4v) videos.

I was using JWPlayer 5, but because of some bugs I need to change it to JWPlayer 6.

   jwplayer('mediaplayer').setup({
    'flashplayer': 'http://www.domain.com/jwplayer/player.swf',
    'id': 'playerID',
    'autostart': 'false',
    'image': 'http://domain-images.s3.amazonaws.com/domain/picture.png', 
    'autostart': 'false',
    'controlbar': 'bottom',
    'width': '640',
    'height': '<?php /*echo $video_player_height;*/ ?>',
    'dock': 'false',
    'stretching': 'fill',
    'icons': 'false',
    'mute': 'false',    
    'volume': '100',            
    'quality': 'false',
    'modes': [
        { type: 'flash', 
          src: 'http://www.domain.com/jwplayer/player.swf', 
          config: {
          'file': '<?php /*echo $media_files[$id]['video']*/ ?>.flv',
          'provider': 'video'
            } 
        },
        { type: 'html5',
          config: {
          'file': '<?php /*echo $media_files[$id]['video']*/ ?>.mp4',
          'provider': 'video'
          }
        },
        { type: 'download',
          config: {
          'file': '<?php /*echo $media_files[$id]['video']*/ ?>.mp4', 
          'provider': 'video'
          }
        }  
    ]
});

Everything was good, but I didn't find how to make same in JWPlayer. Seems that I've read all the documentation, but didn't find the way expect if I'm using RTMP or HLS protocols.


Solution

  • Provide only an MP4, and a simple setup: http://misterneutron.com/JW6video/

    Visitors with modern browsers will see the MP4 played with native HTML5. Visitors with older browsers (like IE8 and earlier) will see the MP4 played with Flash. Visitors who have older browsers but don't have Flash installed will be offered a download.

    The JW Player script takes care of all of this for you, automatically. You don't need to provide multiple formats, and you don't need any sort of "modes" attributes (which don't exist in JW6).

    To make sure your MP4 streams properly, the moov atom must be at the beginning of the file - if it isn't, the whole file will have to download before it starts playing. If it's in the right place, the player will need only the first few seconds of the file before it starts playing.

    To convert another format to MP4, use Handbrake: http://handbrake.fr/. Take the default options, but also check Web optimized. If you're using ffmpeg, use the -movflags faststart attribute. If you have an MP4 that has the moov atom at the end, and you just want to move it, use MP4 FastStart, which has only one purpose - it quickly alters the file to place the moov atom properly: http://www.datagoround.com/lab/