Skip to main content
Participant
May 27, 2010
Question

Issue with play2() and ExternalInterface

  • May 27, 2010
  • 1 reply
  • 842 views

It seems I have run into an issue which has so far been

undocumented. If you call ExternalInterface.addCallback before useing the new DynamicStreamItem() class it breaks.

(need to have FMS dev server installed)

Add a flvPlayback component (v 2.5) to your stage with an instance name of  videoPlayer_mc.

Then add the following actionscript to your main timeline:

----------------------------------------------------------------------------------------------------------

import fl.video.*;
import flash.external.ExternalInterface;
VideoPlayer.iNCManagerClass = NCManagerDynamicStream;


var dsi:DynamicStreamItem = new DynamicStreamItem();
dsi.uri = "rtmp://localhost/vod/";
dsi.addStream("mp4:sample1_150kbps.f4v", 150);
dsi.addStream("mp4:sample1_500kbps.f4v", 500);
dsi.addStream("mp4:sample1_700kbps.f4v", 700);
dsi.addStream("mp4:sample1_1000kbps.f4v", 1000);
dsi.addStream("mp4:sample1_1500kbps.f4v", 1500);
//------
ExternalInterface.addCallback("pauseContent", pauseContent);
videoPlayer_mc.play2( dsi );

function pauseContent():void
{
videoPlayer_mc.pause();
}

----------------------------------------------------------------------------------------------------------

publish the swf and open it in the standalone Flash Player application.  You will see it does not work. But if you comment out the ExternalInterface.addCallback and the function it works fine.  These are 2 unrelated classes with no relationship. What gives. Any insight would be a great help. Commented working code below:

----------------------------------------------------------------------------------------------------------

import fl.video.*;
//import flash.external.ExternalInterface;
VideoPlayer.iNCManagerClass = NCManagerDynamicStream;


var dsi:DynamicStreamItem = new DynamicStreamItem();
dsi.uri = "rtmp://localhost/vod/";
dsi.addStream("mp4:sample1_150kbps.f4v", 150);
dsi.addStream("mp4:sample1_500kbps.f4v", 500);
dsi.addStream("mp4:sample1_700kbps.f4v", 700);
dsi.addStream("mp4:sample1_1000kbps.f4v", 1000);
dsi.addStream("mp4:sample1_1500kbps.f4v", 1500);
//------

/*
ExternalInterface.addCallback("pauseContent", pauseContent);
videoPlayer_mc.play2( dsi );

function pauseContent():void
{
      videoPlayer_mc.pause();
}

*/

    This topic has been closed for replies.

    1 reply

    Janaki Lakshmikanthan
    Adobe Employee
    Adobe Employee
    May 28, 2010

    Hi,

    I tried your code with ExternalInterface statements and the stream started playing fine. I didnt see any issues.

    In the commented code that you have mentioned below, you have commented out "videoPlayer_mc.play2( dsi );" as well. It might be a typo while composing this post.

    Can you tell me to which version of FMS you were trying and the Flash authoring version?

    Also i need the details about the flv playback component package "fl" that you were using?

    Regards,

    Janaki L

    Message was edited by: Janaki Lakshmikanthan

    Participant
    May 28, 2010

    Hello Janaki and thank you for replying.  I have tried it on FMS 3.5 and also FMS dev server. Currently I am testing on the FMS dev server.  I do not believe the FMS is the problem. You say you have run the code and it works. Did you run it in the standalone player,  browser, or dev enviornment? The issue only arrises when using the standalone player. I am authoring in CS4 and I have updated my flvPlayback component to 2.5 and also updated the corresponding component package "fl"as recommended by Adobe.

    Below is the code again just to be sure. Export and launch swf in external standalone Flash Player.

    import fl.video.*;
    import flash.external.ExternalInterface;
    VideoPlayer.iNCManagerClass = NCManagerDynamicStream;


    var dsi:DynamicStreamItem = new DynamicStreamItem();
    dsi.uri = "rtmp://localhost/vod/";
    dsi.addStream("mp4:sample1_150kbps.f4v", 150);
    dsi.addStream("mp4:sample1_500kbps.f4v", 500);
    dsi.addStream("mp4:sample1_700kbps.f4v", 700);
    dsi.addStream("mp4:sample1_1000kbps.f4v", 1000);
    dsi.addStream("mp4:sample1_1500kbps.f4v", 1500);

    ExternalInterface.addCallback("pauseContent", pauseContent);
    videoPlayer_mc.play2( dsi );


    //------
    function pauseContent():void
    {
    videoPlayer_mc.pause();
    }

    Janaki Lakshmikanthan
    Adobe Employee
    Adobe Employee
    June 1, 2010

    I am playing the stream in the stand alone argo player. Which is the stand alone version you are using?

    Also can you try running the swf in Flash CS4 itself. I mean using the option "Control+Enter" - "Test Movie". and let me know what you get in the output logs.

    Even the new code which you have passed me works fine.

    Regards,

    Janaki L