Koala7
Koala7

Reputation: 1404

Hot to apply a loading text before the video-streaming begins

I am working in a project for the front-side.

We have a flash player showing a live video game from external. We have the access by api provided from a third part.

Everything works fine but the big issue now is how to display a simple text "loading" before the stream video starts, this is very necessary because the video delays a bit at the beginning.

I am newbie on it and have made a big search to find something helpful.

I have found a good documentation here and in this page explaining well to how to get external content into my SWF file. But my question is how can i edit my The FlashVars parameter of the HTML when the data is provided by an api?

<div id="flashContent">
        <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="550" height="400" id="FlashVars_AS2" align="middle">
            <param name="movie" value="FlashVars_AS3.swf">
            <param name="quality" value="high">
            <param name="bgcolor" value="#ffff66">
            <param name="play" value="true">
            <param name="loop" value="true">
            <param name="wmode" value="window">
            <param name="scale" value="showall">
            <param name="menu" value="true">
            <param name="devicefont" value="false">
            <param name="salign" value="">
            <param name="allowScriptAccess" value="sameDomain">
            <param name="FlashVars" value="myVariable=Hello%20World&amp;mySecondVariable=Goodbye">
            <!--[if !IE]>-->
            <object type="application/x-shockwave-flash" data="FlashVars_AS3.swf" width="550" height="400">
                <param name="movie" value="FlashVars_AS2.swf">
                <param name="quality" value="high">
                <param name="bgcolor" value="#ffff66">
                <param name="play" value="true">
                <param name="loop" value="true">
                <param name="wmode" value="window">
                <param name="scale" value="showall">
                <param name="menu" value="true">
                <param name="devicefont" value="false">
                <param name="salign" value="">
                <param name="allowScriptAccess" value="sameDomain">
                <param name="FlashVars" value="myVariable=Hello%20World&amp;mySecondVariable=Goodbye">
            <!--<![endif]-->
                <a href="http://www.adobe.com/go/getflash">
                    <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player">
                </a>
            <!--[if !IE]>-->
            </object>
            <!--<![endif]-->
        </object>
    </div>

Thus is the code used by example in the Adobe documentation but i can work on it if my data is provided from a third part and it's not a swf?

Hope my explanation is clear and sorry if it's not because i am not expert on it.

Good examples and different solutions are very welcome too

thanks

Upvotes: 0

Views: 259

Answers (1)

Mista Killa
Mista Killa

Reputation: 16

you should handle NetStatusEvent of your NetStream in video-player

someFunctionShowingLoadingMessage();

stream.addEventListener(NetStatusEvent.NET_STATUS, streamStatusHandler);

        private function streamStatusHandler(event:NetStatusEvent):void {
        switch (event.info.code) {
            case "NetConnection.Connect.Success":
                break;
            case "NetStream.Play.Start":
                break;
            case "NetStream.Buffer.Full":
                // buffer is full and we may show video
                // and hide our simple text "loading..."
                break;
            case "NetStream.Play.Stop":
                break;
            case "NetStream.Play.StreamNotFound":
                break;
        }
    }

Upvotes: 0

Related Questions