Playing FLV Video using FlashLite Part 1

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
719 views
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Mar 16, 2009

This video will show you how to play a streaming flv video file from a mobile device.
This is done using Flash and its Mobile Flash player (FlashLite 3.0)
Note: I couldn't run da app i created while doing the presentation becos i had mistakenly put a
fscommand2("fullscreen",true);
in the 1st frame, (silly me....)

I hope you have a basic knowledge of Flash and action scripting.
Please Comment and Rate the video.

Below is the code i used in frame25.
//Start code
stop();

fscommand2("SetSoftKeys", "Home","Pause");
//Variable to check if the video is being played.
var isPlaying:Boolean;
//create NetConnection and NetStream
var nc:NetConnection = new NetConnection();
var ns:NetStream;

nc.onStatus = function(info)
{
if(info.code == "NetConnection.Connect.Success")
{
ns = new NetStream(nc); //Here the 'VideoPlayer' if the Instance Name of the Video i dragged from the Library
VideoPlayer.attachVideo(ns); //you can pass a URL here too...
ns.play("Stealth.flv");

isPlaying = true;
txtRight.text = "Pause"
}
}

nc.connect(null);

ns.onStatus = function(info){ if(info.code == "NetStream.Play.Stop"){ isPlaying = false; txtRight.text = "Play"; }
};

Key.removeListener (myListener);
var myListener:Object = new Object ();
myListener.onKeyDown = function () { var keyCode = Key.getCode (); // Run this code if the user presses the left soft key. if (keyCode == ExtendedKey.SOFT1) { // Close the video. ns.close();
isPlaying = false; // Go to the home screen. gotoAndPlay (1); } // Run this code if the user presses the right soft key else if (keyCode == ExtendedKey.SOFT2) { // If the video is playing, run this code if (isPlaying){ // Pause or restart the video (this method does both). ns.pause(); // Switch the label text. if (txtRight.text == "Play"){ txtRight.text = "Pause"; } else if (txtRight.text == "Pause"){ txtRight.text = "Play"; } // If the video has finished playing, run this code. } else { // Replay the video. ns.play("Stealth.flv"); txtRight.text = "Pause"; isPlaying = true; } }
};
Key.addListener (myListener);
//Code end

Category:

Education

Tags:

License:

Standard YouTube License

  • likes, 0 dislikes

Link to this comment:

Share to:
see all

All Comments (1)

Sign In or Sign Up now to post a comment!
  • thanx for the help brother

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more