Video Object for FCS Programming

Source: Internet
Author: User
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 );

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.