|
Produces Owner Flv Video Player
Below you will open the Macromedia Flash Player 8 (recommended) to start it!
First of all, the new document, set the background color black, the other by default, and then built four layers.
The first layer to release the video components, as follows:
1, in the "library" panel ( "window"> "Library") from the "library" pop-up menu, select "New Video."
2, in the "Video Properties" dialog box, name the video component and select "Video" (by ActionScript control).
3, the video object from the "library" panel until the middle of the stage to create a video object instance.
4, examples from this video component called "my_video".
The second layer to release the video address input field, as follows:
1, lower left on the stage using the text tool (shortcut T) painting an address input text box, type "input text" type.
2, in the "lines of type" pop-up menu, select "single" and also that "in the text frame around the display" in a selected state.
3, examples from this text box named "url".
The third tier players to release the Start button, as follows:
1, in the "library" panel ( "window"> "Library"), the new component button, the button style to the production of a good time being on the line can be used.
2, the new button object from the "library" panel onto the stage after the address input box to create the Start button to play.
3, this example of players from the Start button called "play_bt".
The fourth floor used to put all the ActionScript:
// First, initialize
// Create a NetConnection object
var my_nc: NetConnection = new NetConnection ();
// Create a local streaming connection
my_nc.connect (null);
// Create a NetStream object
var my_ns: NetStream = new NetStream (my_nc);
// Write a play function playflv ()
function playflv (flv) (
// Parameters of the flv player flv to video address
// trace (flv); // test
// NetStream video input signal will be appended to the Video object, that is, component video my_video
my_video.attachVideo (my_ns);
// Set the buffer time, units of seconds, three seconds can be set below
my_ns.setBufferTime (3);
// Start playing FLV files
my_ns.play (flv);
)
// Click to start the play button to start playing
play_bt.onRelease = function () (
playflv (url.text);
// Get url of the video file input box address, and call the play function to play url video files flv corresponding
);
//////////////////////////////////////////////////////////////////////////////
// At this point one of the most simple player has done, do the following are its more control and performance of the work.
// Here a few important aspects of its production to other Members also need to play to their imagination to design better.
// Note that the following non-essential code, without testing, we hope to achieve one by one try. Special attention to the path and the corresponding instance name.
//*********************************
// 1, the player control, pause, and stop the realization of
// New two buttons, a suspension of (pause_bt), a stop (stop_bt), the same principles and the play button.
pause_bt.onRelease = function () (
my_ns.pause ();
);
stop_bt.onRelease = function () (
my_ns.seek (0);
// Search from 0 to start playing
my_ns.pause (true);
// Parameter true that the suspension, if false, said the suspension to continue to broadcast from, if there is no such parameter is in the pause / play switch.
);
//*********************************
// 2, video download progress
// This is relatively simple, and the general progress of the download is similar to the principle that players will be downloaded and the percentage of total file size, and then displayed.
// Show the percentage of new static text (info) and the progress bar (bar), its initial state, location to adjust the
this.onEnterFrame = function () (
var loadedbytes = my_ns.bytesLoaded;
// Was already downloaded bytes
var totalbytes = my_ns.bytesTotal;
// Total size of documents
if (totalbytes == undefined | | totalbytes <4000) (
info.text = "0%";
bar._width = 1;
) Else (
var nowLoadPercent = Math.round (loadedbytes / totalbytes * 100);
if (isNaN (nowLoadPercent)) (
info.text = "0%";
bar._width = 1;
) Else (
info.text = nowLoadPercent +"%";
bar._width = nowLoadPercent * 35/100;
if (nowLoadPercent == 100) (
delete this.onEnterFrame;
)
)
)
)
//*********************************
// 3, to amend or adjust the video size
// This is more important, because the proportion of video in general not the same size, so players should be adjusted so as to avoid distortion of the deformation.
// The principle is to obtain the size of flv, and then re-adjust the size of my_video Finally, the location of the middle and, if necessary, can also zoom in and out processing (omitted here).
// First write a function to change the size changesize (w, h), w in order to change the width, h is the height of it wants to change the
function changesize (w, h) (
// Change to the parameters of mass size in.
my_video._width = w;
my_video._height = h;
// trace ( "w:" + w + "h:" + h); // test
// Location of the middle to deal with, if you video the stage width of 550, high 400
my_video._x = 550/2-w/2;
my_video._y = 400/2-h/2;
)
// And then to be inherent flv size, and function calls to change it more than
// This handler is called my_ns.play () method in the video player before the first trigger forward
my_ns.onMetaData = function (infoObject: Object) (
// Get the embedded FLV file descriptive information, there was wide / high
var flv_width = infoObject.width;
var flv_height = infoObject.height;
// Change the size of
changesize (flv_width, flv_height);
);
//*********************************
// 4, the broadcasting time and progress
// Principles and to download the progress of similar duration to get the total, and then get a percentage of their current time, nor do the progress bar.
// Total duration of the definition of global variables and their values.
var flv_duration;
my_ns.onMetaData = function (infoObject: Object) (
// Get the embedded FLV file descriptive information, here was the total duration (unit: seconds)
var flv_duration = infoObject.duration;
);
// Note: This can be written with high relief.
// Obtain the current playback time
var flv_thistime = my_ns.time;
// And then the progress of the players will be able to create, and download progress is similar to everyone to produce their own, a little here.
//*********************************
// 5, the volume control
// This complex point, you must attach the audio from the FLV file to video clip on stage, and then to control
// New movie clip my_ns_mc, and additional audio
my_ns_mc.attachAudio (my_ns);
// For the video clip to create a new Sound object
var my_ns_sound = new Sound (my_ns_mc);
// Initialize the volume (here the default 80)
var flv_volume = 80;
my_ns_sound.setVolume (flv_volume);
// Finally, the size of flv_volume (0-100) can control the size of the volume change
// This part of the production is also omitted, all the free play, mute function can also be produced, that is, flv_volume 0
//*********************************
// Also, like fast-forward, rewind, buffer display, etc., are met, all on its own research
|
 |
Bookmark |
News>> |
|
| Aug 6, 2008 |
| Support Paypal Payment. |
| Aug 4, 2008 |
| Power FLV Converter 1.3 Released. |
| Jan 2, 2008 |
| DONGSOFT Web Site Updated. |
| Apr 15, 2008 |
| Power FLV Converter 1.2.1 Released. |
| Apr 5, 2008 |
| Power FLV Converter 1.2 Released. |
| |
Online Support |
|
Step by Step(FLV to AVI, WMV...) |
FAQ |
Submit Your Comments |
|
Our Customers |
|
| We serve hundreds of customers around the world, ranging from companies, social services and community
to school, etc. Also, tons of home
users. click to see typical user list. click to see user reviews . |
Links |
|
| Our Links |
| Exchange Link |
Partners |
|
 |
| |
| |
| |
|