Flex-videoplayer-control
Flex-VideoPlayerコントロール
前書き
ビデオコントロールは、FLVおよびF4vファイルの再生をサポートしています。 このコントロールには、ビデオの再生を制御するためのフル機能のUIが含まれています。
クラス宣言
以下は spark.components.VideoPlayer クラスの宣言です-
public class VideoPlayer
extends SkinnableComponent
パブリックプロパティ
Sr.No | Property & Description |
---|---|
1 |
autoDisplayFirstFrame : Boolean autoPlay = falseの場合、autoDisplayFirstFrameは、ソースが設定されたときにビデオをロードするかどうかを制御します。 |
2 |
autoPlay : Boolean ソースプロパティが設定されたときに、ビデオの再生をすぐに開始するかどうかを指定します。 |
3 |
autoRewind : Boolean stop()メソッドを呼び出すか、ストリームの最後に到達することにより、再生が停止したときにFLVファイルを最初のフレームに巻き戻すかどうかを指定します。 |
4 |
bytesLoaded : Number [read-only] The number of bytes of data that have been downloaded into the application. |
5 |
bytesTotal : Number [read-only] The total size in bytes of the data being downloaded into the application. |
6 |
currentTime : Number [read-only] Current time of the playhead, measured in seconds, since the video starting playing. |
7 |
duration : Number [read-only] Duration of the video’s playback, in seconds. |
8 |
loop : Boolean 再生が完了した後、メディアを再度再生するかどうかを示します。 |
9 |
mediaPlayerState : String [read-only] The current state of the video. |
10 |
muted : Boolean ビデオをミュートするにはtrueに設定し、ビデオのミュートを解除するにはfalseに設定します。 |
11 |
pauseWhenHidden : Boolean ビデオが「非表示」のときに引き続き再生するかどうかを制御します。 |
12 |
playing : Boolean [read-only] Contains true if the video is playing or is attempting to play. |
13 |
scaleMode : String scaleModeプロパティは、ビデオコンテンツのサイズを変更するさまざまな方法を記述します。 |
14 |
source : Object ビデオソース。 |
15 |
videoObject : Video [read-only] The underlying flash player flash.media.Video object. |
16 |
volume : Number ボリュームレベル。0〜1の値として指定します。 |
パブリックメソッド
Sr.No | Method & Description |
---|---|
1 |
VideoPlayer() コンストラクタ。 |
2 |
pause():void 再生ヘッドを移動せずに再生を一時停止します。 |
3 |
play():void ビデオを再生します。 |
4 |
seek(time:Number):void ビデオで与えられた時間を探します。 |
5 |
stop():void ビデオの再生を停止します。 |
保護されたメソッド
Sr.No | Method & Description |
---|---|
1 |
formatTimeValue(value:Number):String 秒単位で指定された時間値を、currentTimeとdurationに使用されるStringにフォーマットします。 |
イベント
Sr.No | Method & Description |
---|---|
1 |
bytesLoadedChange ダウンロード操作の進行中にデータを受信したときに送出されます。 |
2 |
complete 再生ヘッドが再生可能なメディアの継続時間に達したときに送出されます。 |
3 |
currentTimeChange MediaPlayerのcurrentTimeプロパティが変更されたときに送出されます。 |
4 |
durationChange メディアのdurationプロパティが変更されたときに送出されます。 |
5 |
mediaPlayerStateChange MediaPlayerの状態が変更されたときに送出されます。 |
継承されるメソッド
このクラスは、次のクラスからメソッドを継承します-
- spark.components.supportClasses.SkinnableComponent
- mx.core.UIComponent
- mx.core.FlexSprite
- flash.display.Sprite
- flash.display.DisplayObjectContainer
- flash.display.InteractiveObject
- flash.display.DisplayObject
- flash.events.EventDispatcher
- 対象
Flex VideoPlayerコントロールの例
テストアプリケーションを作成して、FlexアプリケーションでのVideoPlayerコントロールの使用を確認するには、次の手順に従います-
Step | Description |
---|---|
1 | Create a project with a name HelloWorld under a package com.finddevguides.client as explained in the Flex - Create Application chapter. |
2 | Add a folder video to src folder. And add sample video to it. |
3 | Modify HelloWorld.mxml as explained below. Keep rest of the files unchanged. |
4 | Compile and run the application to make sure business logic is working as per the requirements. |
以下は、フレックスアプリケーションにビデオを埋め込む方法です。
<s:VideoPlayer source = "video/just for laugh magic trick.flv"
width = "350" height = "250" loop = "true"/>
以下は、変更されたmxmlファイル src/com.finddevguides/HelloWorld.mxml の内容です。
<?xml version = "1.0" encoding = "utf-8"?>
<s:Application xmlns:fx = "http://ns.adobe.com/mxml/2009"
xmlns:s = "library://ns.adobe.com/flex/spark"
xmlns:mx = "library://ns.adobe.com/flex/mx
width = "100%" height = "100%" minWidth = "500" minHeight = "500">
<fx:Style source = "/com/finddevguides/client/Style.css"/>
<s:BorderContainer width = "630" height = "480" id = "mainContainer"
styleName = "container">
<s:VGroup width = "100%" height = "100%" gap = "50"
horizontalAlign = "center" verticalAlign = "middle">
<s:Label id = "lblHeader" text = "Complex Controls Demonstration"
fontSize = "40" color = "0x777777" styleName = "heading"/>
<s:Panel id = "videoPlayerPanel" title = "Using VideoPlayer"
width = "500" height = "300" >
<s:layout>
<s:HorizontalLayout gap = "10" verticalAlign = "middle"
horizontalAlign = "center"/>
</s:layout>
<s:VideoPlayer source = "video/just for laugh magic trick.flv"
width = "350" height = "250" loop = "true"/>
</s:Panel>
</s:VGroup>
</s:BorderContainer>
</s:Application>
すべての変更が完了したら、link:/flex/flex_create_application [Flex-アプリケーションの作成]の章で行ったように、アプリケーションを通常モードでコンパイルして実行します。 アプリケーションに問題がない場合は、次の結果が生成されます。[link:/flex/samples/ComplexControlsApplicationl#currentlyLoaded = VideoPlayer [Try it online]]