defrex
defrex

Reputation: 16425

IE not letting flash stream audio

This problem is happening is both IE8 and IE7. I have a small swf compiled with flex. It's basically just a wrapper around audio streaming functionality. All the controls and such are in html with javascript. I load the swf using swfobject's "static" method. This works great in Firefox and Chrome. In IE, the swf loads correctly, but as soon as I try to stream any audio with it, I get an error.

EDIT: I've reduced the code quite a bit to try and find the problem. You can see the new version running here. Here is the error, html and flex files for my reduced version:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at isolated/playStream()[/home/defrex/code/bd/trunk/ackbar/media/flex/isolated.mxml:19]
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at flash.external::ExternalInterface$/_callIn()
    at <anonymous>()

The HTML:

<!DOCTYPE html>
<html>
    <head>
        <title>fuie</title>
        <script type="text/javascript" src="swfobject.js"></script>
        <script>
            var player;
            swfobject.registerObject("_mediaplayer", "9.0.0", undefined, function(e){
                if (e.success)
                    player = e.ref;
                else
                    console.log('Flash not loaded');
            });
        </script>
    </head>
    <body>
        <a href="#" onclick="player.play_fuie('celebration.mp3');return false;">play track</a>
        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="1" height="1" id="_mediaplayer">
            <param name="movie" value="isolated.swf" />
            <!--[if !IE]>-->
            <object type="application/x-shockwave-flash" data="isolated.swf" width="1" height="1">
            </object>
            <!--<![endif]-->
        </object>
    </body>
</html>

And the flex:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
    <mx:Script>
        import flash.external.ExternalInterface;
        import flash.media.Sound;
        import flash.media.SoundChannel;
        import flash.net.URLRequest;

        public function init():void {
            ExternalInterface.addCallback("play_fuie", playStream);
            ExternalInterface.call("console.log('flash loaded')");
        }

        public function playStream(stream:String):void {
            var url:URLRequest = new URLRequest(stream);
            var audio:Sound = new Sound();
            audio.load(url);
            var chan:SoundChannel = audio.play();
            chan.soundTransform.volume = 0.5;
        }
    </mx:Script>
</mx:Application>

Upvotes: 1

Views: 1458

Answers (2)

defrex
defrex

Reputation: 16425

After 3 frustrating days if debugging, the moral of the story: software piracy is bad. As it turns out the sketchy "XP Pirate Edition" that was passed around the dev team for IE testing in VirtualBox had some kind of bug (or perhaps malware) that was causing the issue. When we tried the test in Chrome installed in the same VM and it came up with the same error (while Chromium under Linux was working beautifully), we realized that there might be something wrong with the OS. Sure enough, when we got our hands on a legitimate version of IE everything worked perfectly.

Karma can be cruel.

Upvotes: 1

Eran
Eran

Reputation: 1702

Its hard to see in your code how stream is passed to flash , if it is from your flash params keep in mind that ie and firefox have different syntax to passing parameters to flash object

http://www.cflex.net/showFileDetails.cfm?ChannelID=1&Object=File&ObjectID=285

Upvotes: 0

Related Questions