load('playlists/playlist.rss'); #$feed->load('http://chillpill.sk/files/156602/playlist.rss'); #$feed->load('http://content.jwplatform.com/feeds/13ShtP5m.rss'); $valid = false; if($rss_url){ $valid = $feed->load($rss_url); } else { $valid = $feed->loadXML($rss_text); } if($valid){ $json = array(); #json['title'] = $feed->getElementsByTagName('channel')->item(0)->getElementsByTagName('title')->item(0)->firstChild->nodeValue; #$json['description'] = $feed->getElementsByTagName('channel')->item(0)->getElementsByTagName('description')->item(0)->firstChild->nodeValue; #$json['link'] = $feed->getElementsByTagName('channel')->item(0)->getElementsByTagName('link')->item(0)->firstChild->nodeValue; $items = $feed->getElementsByTagName('channel')->item(0)->getElementsByTagName('item'); #$json['item'] = array(); $i = 0; foreach($items as $item) { $i++; $title = $item->getElementsByTagName('title')->item(0)->firstChild->nodeValue; $description = $item->getElementsByTagName('description')->item(0)->firstChild->nodeValue; $image = $item->getElementsByTagName('image')->item(0)->firstChild->nodeValue; $mediaid = $item->getElementsByTagName('guid')->item(0)->firstChild->nodeValue; $sources = $item->getElementsByTagName('source'); $tracks = $item->getElementsByTagName('track'); $pli = array(); $pli['title'] = $title; $pli['description'] = $description; $pli['image'] = $image; $pli['mediaid'] = $mediaid; $pli['sources'] = array(); $pli['tracks'] = array(); foreach($sources as $src) { $files = array(); $files['file'] = $src->getAttribute('file'); $files['type'] = $src->getAttribute('type'); $files['label'] = $src->getAttribute('label'); $files['default'] = $src->getAttribute('default'); array_push($pli['sources'],$files); } foreach($tracks as $trk) { $files = array(); $files['file'] = $trk->getAttribute('file'); $files['type'] = $trk->getAttribute('kind'); $files['label'] = $trk->getAttribute('label'); $files['default'] = $trk->getAttribute('default'); array_push($pli['tracks'],$files); } array_push($json,$pli); } } } ?> RSS 2 JSON // Listy for JW Player

Convert RSS to JW Player 6 compatible JSON

When dealing with JW Player playlists, the external RSS feed format can be quite appealing - particularly when it comes to decoupling the ongoing management of the playlist from the initial embed code.

However, this approach can commonly cause confusion and frustration due to the following:

  • Cross-protocol / Cross-domain loading issues - particularly evident when cloud-hosting the player code, and having it render in Flash mode. This will require a valid crossdomain.xml file to be available on the RSS hosting server which allows access from the *.jwpcdn.com sub-domain.
  • CORS issues - this requires cross-domain security to be allowed on the individual RSS file when accessed from a difference origin domain. Commonly an issue when the player is rendered in HTML5 mode.
  • 302 redirects - depending on where the RSS file is hosted, it may be subject to a 302 redirect. Increasingly, hosting providers offer vanity URL or application level URLs which are translated to lower-level URLs on request. Unfortunately when used in conjunction with certain browsers, JW Player doesn't handle 302 redirects when requesting additional assets via XHR.

This tool provides the means to convert external JW Player RSS playlists into the inline JSON format. You can therefore build and manage your playlist in an easily readable format, and then if you prefer (or wish to overcome the issues detailed above), you can embed using the inline JSON format.

RSS URL input

JSON output