Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP return video URL for Flash player to load via Javascript
    text
    copied!<p>I have a SWF loaded via a "swfobject.embedSWF()"</p> <p>I use Javascript's methods to pass calls via the flash APIs: <a href="http://developer.longtailvideo.com/trac/wiki/Player4Api#Sendingevents" rel="nofollow">http://developer.longtailvideo.com/trac/wiki/Player4Api#Sendingevents</a></p> <pre><code>call.player.sendEvent('LOAD', theFile) </code></pre> <p>Using a XMLHttpRequest() call via GET to a PHP script I get a file url:</p> <pre><code>http://xx.yy.com/protected/5dde98716ad8f31127ab560d94f96b87/4cbabea0/test.mp4 </code></pre> <p>Typing the URL into my browser starts the file, but passing the variable to the sendEvent() call does nothing. Why?</p> <pre><code>var response = http.responseText; loadFile(response); player.sendEvent('PLAY'); </code></pre> <p>Is there something obvious that I am doing wrong? :/</p> <p>Thanks.</p> <p><strong>EDIT1: Solution</strong></p> <p>I have gotten the generated url to load and play correctly by not just returning the video url with the <code>XMLHttpRequest()</code> but returning an actual xml file with the necessary parameters to work with some of the modules I am using.</p> <pre><code>&lt;rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/" xmlns:jwplayer="http://developer.longtailvideo.com/trac/wiki/FlashFormats"&gt; &lt;channel&gt; &lt;title&gt;Example media RSS playlist&lt;/title&gt; &lt;item&gt; &lt;title&gt;Lighttpd Video&lt;/title&gt; &lt;media:content url="http://xx.yy.com/protected/91aa7dfa25596a7d59c3b9403fc4773f/4cbb35d6/test.mp4" /&gt; &lt;jwplayer:provider&gt;http&lt;/jwplayer:provider&gt; &lt;jwplayer:http.startparam&gt;start&lt;/jwplayer:http.startparam&gt; &lt;/item&gt; &lt;/channel&gt; &lt;/rss&gt; </code></pre> <p>I wonder if this is as obvious as it seems now. Can <code>XMLHTTPRequest()</code> only return responses formatted as xml files? :/</p>
 

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