Note that there are some explanatory texts on larger screens.

plurals
  1. POJWPlayer and Proxying MP3 Files Through PHP
    primarykey
    data
    text
    <p>This is for a project designed for personal use only.</p> <p>I installed <a href="http://www.longtailvideo.com" rel="nofollow">JWPlayer</a> onto my local dev server. This is a functioning playlist I have used and verified works:</p> <pre><code>&lt;rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/"&gt; &lt;channel&gt; &lt;title&gt;oTunes Web App - Playlist&lt;/title&gt; &lt;item&gt; &lt;title&gt;My Baby Loves Me by Martina McBride on Greatest Hits&lt;/title&gt; &lt;media:content url="07TheGift.mp3" duration="156" /&gt; &lt;/item&gt; &lt;/channel&gt; &lt;/rss&gt; </code></pre> <p>This playlist does not work:</p> <pre><code>&lt;rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/"&gt; &lt;channel&gt; &lt;title&gt;oTunes Web App - Playlist&lt;/title&gt; &lt;item&gt; &lt;title&gt;My Baby Loves Me by Martina McBride on Greatest Hits&lt;/title&gt; &lt;media:content url="ajax.php?ajax=getMP3Version&amp;track=38809" duration="156" /&gt; &lt;/item&gt; &lt;/channel&gt; &lt;/rss&gt; </code></pre> <p>ajax.php has been developed to handle all AJAX requests, including acting as a "proxy" for MP3 files, since the MP3 files are in a non-web-accessable directory (a different drive). Here is the relevant code snipplet from ajax.php:</p> <pre><code>$initial = $_GET['initial']; session_start(); echo $tracks-&gt;generatePlaylistString($_SESSION['last_results'], $initial); </code></pre> <p>This is the relevant code from the $tracks class:</p> <pre><code> function generatePlaylistString($data, $initial) { $playlistData = $data; $firstToPlay = $initial; $round = 1; $addToPlaylist = false; $playlistString = '&lt;rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/"&gt; &lt;channel&gt; &lt;title&gt;oTunes Web App - Playlist&lt;/title&gt; '; foreach($playlistData AS $item) { if ($item['TrackUniqueID'] == $firstToPlay) { $addToPlaylist = true; } if ($addToPlaylist) { $durationArray = explode(":", $item['TrackTotalDuration']); $playlistString .= ' &lt;item&gt; &lt;title&gt;'.$item['TrackTitle'].' by '.$item['TrackArtist'].' on '.$item['TrackAlbum'].'&lt;/title&gt; &lt;media:content url="ajax.php?ajax=getMP3Version&amp;track='.$item['TrackUniqueID'].'" duration="'.(($durationArray[0]*60)+$durationArray[1]).'" /&gt; &lt;/item&gt; '; } } $playlistString .= ' &lt;/channel&gt; &lt;/rss&gt;'; return $playlistString; } </code></pre> <p>The playlist is formatted correctly, because I replaced the call to the proxy PHP file with a call to a static file (see above) and the song played correctly. I go to the PHP page in my browser, and I am prompted to play the file (and it plays correctly also). I use Firebug to confirm that the proper calls and responses are being made, and they all are. However, when I put the call to the proxy PHP page into the playlist, I get the following error:</p> <blockquote> <p>Playlist could not be loaded: Playlist file did not contain a valid playlist</p> </blockquote> <p>I don't know what else to do, besides move all the MP3 files into a web-accessable directory (which I do not want to do, for control and resource reasons). Any help?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload