Loading and Controlling External Video
Số trang: 13
Loại file: pdf
Dung lượng: 40.47 KB
Lượt xem: 12
Lượt tải: 0
Xem trước 2 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
Kiểm soát tải và ngoài Video Với sự phổ biến ngày càng tăng của băng thông rộng, việc sử dụng video trong các ứng dụng tiếp tục leo thang. May mắn cho chúng tôi, do đó, làm Flash của khả năng cho tải và chơi video.
Nội dung trích xuất từ tài liệu:
Loading and Controlling External Video < Day Day Up >Loading and Controlling External VideoWith the growing popularity of broadband, the use of video in applications continues toescalate. Fortunately for us, so do Flashs capabilities for loading and playing video.The previous version of Flash (Flash MX) could load and play external video clips, butonly with the assistance of Flash Communication Server. It was possible to embed videoclips within the SWF, but this tended to make the file size rather large. Not only doesFlash MX 2004 not need Flash Communication Server when using external video, but itprovides some excellent tools in the form of Media components. These tools make theprocess of using video in your applications much easier.External video clips have some great advantages over embedded clips: • The clip can be edited separately from the SWFs that use it. • The clip can be progressively downloaded as it plays, making it unnecessary for the entire clip to load before it can be viewed. • The clip can play at a different frame rate than the SWF in which its loaded, ensuring that the video clip always plays at the intended frame rate.To use an external video clip in a Flash project, it must first be converted to the .flv(Flash Video) file format. Flash has the built-in capability to import most video formats(including AVI and QuickTime), which can then be exported to the FLV format for useas an externally loaded clip. Although this is a sufficient means for creating FLV files,you may want to create, edit, and eventually export a video from your favorite video-editing application, such as Adobe Premiere. Fortunately, Flash MX 2004 Professionalships with the Flash Video Exporter. After installation, the Exporter allows you to exportFLV files directly from your favorite video-editing application. (For more informationabout importing and creating FLV files, consult your Flash documentation.)TIPSorenson Medias excellent application called Sorenson Squeeze was built for thepurpose of creating FLV files from many video file formats. For more information aboutthis useful tool, visit www.sorenson.com.After you have a usable FLV file, you need to know how to load it into Flash as well ashow to control it and communicate with it. The direct way is by creating an instance ofthe Video class and then loading video into that object via instances of the NetConnectionand NetStream classes. If that sounds like too much work, youre absolutely right. A moreelegant solution is to use the incredibly versatile and powerful Media components thatship with Flash MX 2004 Professional. These components allow you to work with theMedia class to handle the most demanding video-related tasks, including the use of cuepoints.The Media components come in three forms: • MediaDisplay. This component is used as a container for loading and playing either external FLV or MP3 files. Graphical playback controls are not provided with this component, but the loaded file can be controlled using methods of the component, including play() and stop(), or by setting property values such as volume. This component is useful for inserting media into your project without the added intrusion of playback controls. • MediaController. This component complements the MediaDisplay component by providing playback controls for controlling media loaded into a MediaDisplay instance. Media is never loaded into or played by the MediaController; the MediaController is used only for controlling playback in a MediaPlayback or MediaDisplay instance. This component allows you to place media in one location on the screen, via the MediaDisplay component, and control it from another location on the screen. Associating an instance of the MediaController component (named controller) with an instance of MediaDisplay component (named display) is as simple as this: • • controller.associateDisplay(display); • • MediaPlayback. This component contains the combined functionality of both the MediaDisplay and MediaController components.Although the Component Inspector provides a visual way of configuring Mediacomponent instances, there are a number of properties, methods, and events that can beused to configure and control Media component instances via ActionScript. All thesecomponents inherit functionality from the Media class, which means that instances of thecomponents can be controlled and configured using common commands. Lets look atwhat you can do with Media component instances.One of the most important tasks a Media component instance can perform is to loadmedia. This can be done using the setMedia() method:myMediaComponent.setMedia(myVideo.flv, FLV);This line loads myVideo.flv into the Media component instance namedmyMediaComponent. Because Media components can also load MP3 files, the secondparameter of the setMedia() method is used to define the media type. Loading an MP3file into the same instance would look like this:myMediaComponent.setMedia(mySong.mp3, MP3);NOTEMedia cannot be loaded into instances of the MediaController component.After media has been loaded into an instance, its playback can be controlled viaActionScript using the play(), pause() and stop() methods. Heres an example of theplay() method:myMediaComponent.play();NOTEOf course, the playback of media is also controlled automatically via playback controlswhen using the MediaController and MediaPlayback instances.Media component instances generate various events, allowing your application to react tosuch actions as a click of the Play button, the end of playback, or a volume adjustment bythe user. Reacting to these events requires Listener objects. For exa ...
Nội dung trích xuất từ tài liệu:
Loading and Controlling External Video < Day Day Up >Loading and Controlling External VideoWith the growing popularity of broadband, the use of video in applications continues toescalate. Fortunately for us, so do Flashs capabilities for loading and playing video.The previous version of Flash (Flash MX) could load and play external video clips, butonly with the assistance of Flash Communication Server. It was possible to embed videoclips within the SWF, but this tended to make the file size rather large. Not only doesFlash MX 2004 not need Flash Communication Server when using external video, but itprovides some excellent tools in the form of Media components. These tools make theprocess of using video in your applications much easier.External video clips have some great advantages over embedded clips: • The clip can be edited separately from the SWFs that use it. • The clip can be progressively downloaded as it plays, making it unnecessary for the entire clip to load before it can be viewed. • The clip can play at a different frame rate than the SWF in which its loaded, ensuring that the video clip always plays at the intended frame rate.To use an external video clip in a Flash project, it must first be converted to the .flv(Flash Video) file format. Flash has the built-in capability to import most video formats(including AVI and QuickTime), which can then be exported to the FLV format for useas an externally loaded clip. Although this is a sufficient means for creating FLV files,you may want to create, edit, and eventually export a video from your favorite video-editing application, such as Adobe Premiere. Fortunately, Flash MX 2004 Professionalships with the Flash Video Exporter. After installation, the Exporter allows you to exportFLV files directly from your favorite video-editing application. (For more informationabout importing and creating FLV files, consult your Flash documentation.)TIPSorenson Medias excellent application called Sorenson Squeeze was built for thepurpose of creating FLV files from many video file formats. For more information aboutthis useful tool, visit www.sorenson.com.After you have a usable FLV file, you need to know how to load it into Flash as well ashow to control it and communicate with it. The direct way is by creating an instance ofthe Video class and then loading video into that object via instances of the NetConnectionand NetStream classes. If that sounds like too much work, youre absolutely right. A moreelegant solution is to use the incredibly versatile and powerful Media components thatship with Flash MX 2004 Professional. These components allow you to work with theMedia class to handle the most demanding video-related tasks, including the use of cuepoints.The Media components come in three forms: • MediaDisplay. This component is used as a container for loading and playing either external FLV or MP3 files. Graphical playback controls are not provided with this component, but the loaded file can be controlled using methods of the component, including play() and stop(), or by setting property values such as volume. This component is useful for inserting media into your project without the added intrusion of playback controls. • MediaController. This component complements the MediaDisplay component by providing playback controls for controlling media loaded into a MediaDisplay instance. Media is never loaded into or played by the MediaController; the MediaController is used only for controlling playback in a MediaPlayback or MediaDisplay instance. This component allows you to place media in one location on the screen, via the MediaDisplay component, and control it from another location on the screen. Associating an instance of the MediaController component (named controller) with an instance of MediaDisplay component (named display) is as simple as this: • • controller.associateDisplay(display); • • MediaPlayback. This component contains the combined functionality of both the MediaDisplay and MediaController components.Although the Component Inspector provides a visual way of configuring Mediacomponent instances, there are a number of properties, methods, and events that can beused to configure and control Media component instances via ActionScript. All thesecomponents inherit functionality from the Media class, which means that instances of thecomponents can be controlled and configured using common commands. Lets look atwhat you can do with Media component instances.One of the most important tasks a Media component instance can perform is to loadmedia. This can be done using the setMedia() method:myMediaComponent.setMedia(myVideo.flv, FLV);This line loads myVideo.flv into the Media component instance namedmyMediaComponent. Because Media components can also load MP3 files, the secondparameter of the setMedia() method is used to define the media type. Loading an MP3file into the same instance would look like this:myMediaComponent.setMedia(mySong.mp3, MP3);NOTEMedia cannot be loaded into instances of the MediaController component.After media has been loaded into an instance, its playback can be controlled viaActionScript using the play(), pause() and stop() methods. Heres an example of theplay() method:myMediaComponent.play();NOTEOf course, the playback of media is also controlled automatically via playback controlswhen using the MediaController and MediaPlayback instances.Media component instances generate various events, allowing your application to react tosuch actions as a click of the Play button, the end of playback, or a volume adjustment bythe user. Reacting to these events requires Listener objects. For exa ...
Tìm kiếm theo từ khóa liên quan:
máy tính mạng máy tính internet phần mềm ứng dụng lập trình SQL HTML sever web XMLGợi ý tài liệu liên quan:
-
Giáo án Tin học lớp 9 (Trọn bộ cả năm)
149 trang 245 0 0 -
Ngân hàng câu hỏi trắc nghiệm môn mạng máy tính
99 trang 235 1 0 -
47 trang 233 3 0
-
Đề cương chi tiết học phần Thiết kế và cài đặt mạng
3 trang 228 0 0 -
Giáo trình Hệ thống mạng máy tính CCNA (Tập 4): Phần 2
102 trang 227 0 0 -
Bài giảng: Lịch sử phát triển hệ thống mạng
118 trang 226 0 0 -
Giáo trình Hệ thống mạng máy tính CCNA (Tập 4): Phần 1
122 trang 196 0 0 -
80 trang 194 0 0
-
122 trang 189 0 0
-
Giáo trình môn học/mô đun: Mạng máy tính (Ngành/nghề: Quản trị mạng máy tính) - Phần 1
68 trang 182 0 0