Showing posts with label JW Player. Show all posts
Showing posts with label JW Player. Show all posts

Saturday, February 2, 2013

JWPlayer Playlist


Introduction to playlists
A playlist is a sequential list of video, audio or image files. The JW Player supports various scenarios to load, show and interact with such playlists.

An entry in the playlist is not just a URL to the media file, but an object that can have multiple properties, such as file, image, title, description, provider and duration. The more properties are provided, the more information the player can display about that entry.

Playback of a playlist can be customized by two configuration options:
repeat
This option defines what the player should do when an item finishes playback. The default is none (do nothing). It can be set to list (play the next entry until the entire list is done), always (keep on playing the entries forever) and single (re-play the current entry).
shuffle
By default, the player starts a playlist with the first entry and then plays all entries sequentially. Set this option to true to let the player randomly select which entry to play next.

Loading inline JSON playlists
The easiest way to load a playlist is to define it as a JavaScript object (JSON) your HTML code. The JW Embedder allows you to do this (this does not work with the SWFObject and <embed> methods). Here's an example:

<div id="container"></div>

<script type="text/javascript">
    jwplayer("container").setup({
        'flashplayer': 'jwplayer.swf',
        'playlist': [{
            'file': '/videos/video1.mp4',
            'image': '/thumbs/video1.jpg',
            'title': 'The first video'
        },{
            'file': '/videos/video2.mp4',
            'image': '/thumbs/video2.jpg',
            'title': 'The second video'
        }],
        repeat: 'list'
    });
</script>

This code will result in a player with two videos, which will play back to back. In the controlbar, a previous entry and next entry button will appear. These can be used to navigate the playlist.


Jwplayer_playlist_prevnext_buttons


Loading external RSS playlists
Next to inline JSON playlists, it is possible to load external playlists into the JW Player. These external playlists should be in the (widely used) RSS format. The Yahoo! Media extension can be used to include media-specific data in the RSS feed (e.g. <:media:thumbnail> for the preview image).

The RSS feed can simply be loaded into the JW Player by assigning it to the file configuration option. Example:

<div id="container"></div>

<script type="text/javascript">
    jwplayer("container").setup({
        'flashplayer': '/assets/jwplayer.swf',
        'file': '/assets/playlist.xml'
    });
</script>


Note that JW Player supports additional playlist formats in Flash-only mode. For HTML5, the player only supports mediaRSS (as of version 5.7). Since mediaRSS is the industry standard for media playlists too, we strongly recommend you use this format.

Crossdomain loading
An important issue to keep in mind with playlists is that they cannot be loaded cross-domain. In other words, if your player is embedded at http://somesite.com, you cannot load an RSS playlist from http://othersite.com. This restriction applies to both Flash and HTML5. There are workarounds though:

You can place a small (PHP) script on the server that hosts your player to proxy the external playlist. This is the easiest solution which works for both Flash and HTML5.
If you're using only the Flash mode of JW Player (no HTML5), you can place a crossdomain.xml file on the server that hosts the playlists.
A very technical solution for HTML5 is to configure the server that hosts your playlists for Cross-Origin Resource Sharing.

Playlist UI component
In addition to loading/playing a playlist, JW Player can display the list in a dedicated UI component. Users can scroll through the playlist and select the entry they want to view. An entry's image, title, description and duration are shown.

To enable the visual playlist, set the following two options:

playlist.position
Where to place the playlist relative to the video. Can be set to bottom or right.
playlist.size
Width (if position=right) or height (if position=bottom) of the playlist in pixels. The default is 180.
Here's how to set the Playlist UI in combination with an RSS feed:

<div id="container"></div>

<script type="text/javascript">
    jwplayer('container').setup({
        'file': '/assets/playlist.xml',
        'flashplayer': '/assets/player.swf',
        'width': '720',
        'height': '240',
        'playlist.position': 'right',
        'playlist.size': '320'
    });
</script>

The resulting player will look like this, with the playlist located at the right side:


jwplayer_playlist_ui_component

In HTML5 mode, the playlist UI component will be displayed the same way, but note that in iOS, the default scrolling behavior is a bit different, requiring that the user use a two-finger swipe gesture to scroll the playlist. The JW Player includes support for the iScroll JavaScript library, which enables one-finger scrolling in iOS. Simply download the script and include it in your page's <head> tag to enable it:

<head>
  <script type="text/javascript" src="/jwplayer/iscroll-4.js"></script>
</head>

Playlist skinning
JW Player supports a flexible skinning model that allows designers to dramatically change the look of a player. The playlist UI component can also get skinned, and many of the freely available skins do so.

Some skins (e.g. Modieus) assign each playlist entry lots of space, so a large description will fit. In other skins (e.g. Bekle), each playlist entry is very narrow, solely displaying the titles of the entries.

See our skin building guide for in-depth info on skinning the playlist UI component and the player in general.

Plugins & Providers
JW Player features an extensive plugin model for extending its functionality (e.g. for Captioning). The player also supports so-called providers to extend the underlying playback capabilities (e.g. for RTMP Streaming). Both plugins and providers supply configuration options that can be set per playlist entry.

For inline JSON playlists, you can simply insert these options in the HTML code. The options should be prepended with the name of the plugin/provider and a dot. Here's an example configuration that uses the captions plugin, with a dedicated captions file per playlist entry:

<div id="container"></div>

<script type="text/javascript">
    jwplayer("container").setup({
        'flashplayer': 'jwplayer.swf',
        'playlist': [{
            'file': '/videos/video1.mp4',
            'title': 'The first video',
            'captions.file': '/assets/captions1.txt'
        },{
            'file': '/videos/video2.mp4',
            'title': 'The second video',
            'captions.file': '/assets/captions2.txt'
        }],
        plugins: {
            captions: {}
        }
  });
</script>

For external RSS playlists, you can use the jwplayer: extension to insert these custom properties. Here's the same example playlist in RSS format:

<rss version="2.0" xmlns:jwplayer="http://developer.longtailvideo.com/">
<channel>
    <item>
        <title>The first video</title>
        <jwplayer:file>/videos/video1.mp4</jwplayer:file>
        <jwplayer:captions.file>/assets/captions1.txt</jwplayer:captions.file>
    </item>
    <item>
        <title>The second video</title>
        <jwplayer:file>/videos/video2.mp4</jwplayer:file>
        <jwplayer:captions.file>/assets/captions2.txt</jwplayer:captions.file>
    </item>
</channel>
</rss>

Note the top level element, which describes the JW Player namespace using the xmlns:jwplayer attribute. This must be available in order to not break validity.


Keywords: JW Player, Playlist, Blogger, Blogger Tutorial, Blogger Embedding, Blog, Website.


Friday, January 25, 2013

JW Player-Subtitles-Closed Caption-Audio Description Plugins


Captions plugin and Audio Description plugin are used to load both a captions SRT and an audio description MP3 file. Both can be toggled on/off through a large, descriptive button in the display area. The plugins are automatically loaded by JW Player from our CDN:
        plugins: {
            captions: { file: '/assets/Parker.srt' },
            audiodescription: { file: '/assets/Parker.mp3' }
        }
    });
</script>


Here is a basic setup with both Audio Description and Closed Captions

Embed Code

SWFObject 1.5
<script type='text/javascript' src='swfobject-1.5.js'></script><div id='mediaplayer'></div><script type="text/javascript">    var so = new SWFObject('player.swf','playerID','480','300','9');    so.addParam('allowfullscreen','true');    so.addParam('allowscriptaccess','always');    so.addVariable('file', '/assets/Parker.mp4');    so.addVariable('image', '/assets/Parker.jpg');    so.addVariable('plugins', 'audiodescription-2,captions-2');    so.addVariable('audiodescription.file', '/assets/Parker.mp3');    so.addVariable('captions.file', '/assets/Parker.srt');    so.write('mediaplayer');</script>

SWFObject 2.2
<script type='text/javascript' src='swfobject-2.2.js'></script><div id='mediaplayer'></div><script type="text/javascript">   var flashvars = {      'file':   '/assets/Parker.mp4',      'image':  '/assets/Parker.jpg',      'plugins':        'audiodescription-2,captions-2',      'audiodescription.file':  '/assets/Parker.mp3',      'captions.file':  '/assets/Parker.srt'   };       var params = {      'allowfullscreen':        'true',      'allowscriptaccess':      'always'   };    var attributes = {      'id':                     'playerID',      'name':                   'playerID'   };   swfobject.embedSWF('player.swf', 'mediaplayer', '480', '300', '9', 'false',        flashvars, params, attributes);    </script>

JW Embedder
<script type='text/javascript' src='/jwplayer/jwplayer.js'></script><div id='mediaplayer'></div><script type="text/javascript">  jwplayer('mediaplayer').setup({    'flashplayer': 'player.swf',    'id': 'playerID',    'width': '480',    'height': '300',    'file': '/assets/Parker.mp4',    'image': '/assets/Parker.jpg',    'plugins': {       'audiodescription-2': {           'file': '/assets/Parker.mp3'       },       'captions-2': {           'file': '/assets/Parker.srt'       }    }  });</script>

If you prefer a black box around the captions instead of a thin outline, set the back option to true.

Other accessibility features of this player are its keyboard controls (using the TAB and SPACE controls), its screen reader-labeled buttons and the full-screen button. Also, immediately above the player, hidden controls allow screen reader users to control the basic functionality of the player (Play / Mute / Stop).



Keywords: Closed Caption,Audio Description, Plugins, Subtitles, Tutorial, Blogger Tutorial, Tutorials,JW Player-Blogger Embedding,Website.


Saturday, March 3, 2012

JW Player-Blogger Embedding


Its very simple. You should put a space beteween embed & src. It has to look like this:
<embed src="http://www.jeroenwijering.com/embed/player.swf"width="720"height="324"allowscriptaccess="always"allowfullscreen="true"flashvars="height=324&width=720&file=http://x264.servebeer.com/550.mp4&searchbar=false&smoothing=false"/>

And NOT like that:
<embedsrc="http://www.jeroenwijering.com/embed/player.swf"width="720"height="324"allowscriptaccess="always"allowfullscreen="true"flashvars="height=324&width=720&file=http://x264.servebeer.com/550.mp4&searchbar=false&smoothing=false"/>

Deactivate auto play for embedded video
autostart (false): Set this to true in the player to automatically start playing when the page loads.

"HTML can not be accepted. Tag is not closed"
Blogger don't like autoclosing tags. Instead of just
  />
 at the end, you should use
</embed>



Exemple



Keywords: Blog, Blogger, Blogger Embedding, Blogger Tutorial, JW Player, Tutorials.