views:

22

answers:

2

Hello Hello

I have a SWF loaded via a "swfobject.embedSWF()"

I use Javascript's methods to pass calls via the flash APIs: http://developer.longtailvideo.com/trac/wiki/Player4Api#Sendingevents

call.player.sendEvent('LOAD', theFile)

Using a XMLHttpRequest() call via GET to a PHP script I get a file url:

http://xx.yy.com/protected/5dde98716ad8f31127ab560d94f96b87/4cbabea0/test.mp4

Typing the URL into my browser starts the file, but passing the variable to the sendEvent() call does nothing. Why?

var response = http.responseText;    
loadFile(response);
player.sendEvent('PLAY');

Is there something obvious that I am doing wrong? :/

Thanks.

EDIT1: Solution

I have gotten the generated url to load and play correctly by not just returning the video url with the XMLHttpRequest() but returning an actual xml file with the necessary parameters to work with some of the modules I am using.

<rss version="2.0" 
    xmlns:media="http://search.yahoo.com/mrss/" 
    xmlns:jwplayer="http://developer.longtailvideo.com/trac/wiki/FlashFormats"&gt;
    <channel>
        <title>Example media RSS playlist</title>
        <item>
            <title>Lighttpd Video</title>
            <media:content url="http://xx.yy.com/protected/91aa7dfa25596a7d59c3b9403fc4773f/4cbb35d6/test.mp4" />
            <jwplayer:provider>http</jwplayer:provider>
            <jwplayer:http.startparam>start</jwplayer:http.startparam>
        </item>
    </channel>
</rss>

I wonder if this is as obvious as it seems now. Can XMLHTTPRequest() only return responses formatted as xml files? :/

A: 

In AS3 , you have to use the Sound class in order to play a sound. Your sound instance will need to load the URL , via a URLRequest object , in order for the sound to be played.

PatrickS
It is more of a video file I am trying to load than a sound, but I will look into using URLRequest() to get the url.
Morrowind789
A: 

The file is not being loaded probably because is cross-domain restrictions in flash.

I'm assuming that the domain from where flash swf is being loaded is not same the domain from where the audio file is being loaded.

To override this restriction you need a crossdomain.xml file placed at the root directory of the server where your sound file is hosted.

<?xml version="1.0"?>
<!-- http://www.youtube.com/crossdomain.xml -->
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"&gt;
<cross-domain-policy>
  <allow-access-from domain="*" />
</cross-domain-policy>

this file should be placed at the root directory of your web server, ie, http://xx.yy.com/crossdomain.xml

Nands
I am using lighttpd and I have done this. I will try it with your given .xml though, see if that works better than the one I already have.
Morrowind789
You might also want to install the debug version of flash player and install flashbug for debugging. This might catch any exceptions that the longtail player is throwing.
Nands