A video object is used to display real-time or recorded video streams. The video object can be a real-time video captured through the camera. Get method, or a real-time video file or a recorded video file or MP3 audio file played using the netstream. Play method.
To display video streams, you must first place the video object to the stage, and then use the video. attachvideo method to attach the video stream to the video object. 1: my_cam = camera. Get ();
2: my_video.attachvideo (mycam); // myvid is a video object placed on the stage.
The usage of video objects is similar to MC. You can set different attributes like other objects that can be placed on the stage. Common attributes of video objects include:
Width: the width of the video object.
Height the height of the Video Object
Whether deblocking is used for filtering. The default value is 0 for automatic adaptation, 1 for never use, and 2 for always use.
Whether smoothing uses smooth transition. The default value is false. If it is true, smooth transition is used (high quality playback mode is required)
The following example shows how to publish, record, and play back a video 01: // record a video file simultaneously during real-time playback.
02: // The recorded video is named 'allaboutme. flv'
03: var my_nc: netconnection = new netconnection ();
04: my_nc.connect ('rtmp: // localhost/allaboutme/myspeech ');
05: var publish_ns: netstream = new netstream (my_nc );
06: publish_ns.publish ('allaboutme ', 'record ');
07: publish_ns.attachvideo (camera. Get ());
08:
09: // play the recorded video file
10: // Note: you do not need to publish a video stream when playing a recording file.
11: var my_nc: netconnection = new netconnection ();
12: my_nc.connect ('rtmp: // localhost/allaboutme/myspeech ');
13: var subscribe_ns: netstream = new netstream (my_nc );
14: subscribe_ns.play ('allaboutme ');
15: my_video.attachvideo (subscribe_ns); // my_video is a video object entity.
To clear the current video object, use the clear method 1: my_video.clear ();
It should be noted that clearing the video object does not mean that the connection is interrupted. to interrupt the stream playing in the video object, you can do this: 1: my_video.attachvideo (null );