doubleClick-v2-as3.0 学习笔记(2)--Video相关

 1 一  play pause stop 可以使用 

 2 

 3 二 com.google.ads.studio.events.VideoEvent

 4 

 5 三 得到控制类 myVideo.getCurrentVideoController()

 6 

 7 四  addEventListener(VideoEvent.PLAY,onVideoPlay);

 8 

 9        addEventListener(VideoEvent.MID_POINT,onVideoPoint);

10 

11        addEventListener(VideoEvent.COMPLETE,onPlayComplete);

12 

13  

14 

15 五  AdvancedVideoPlayer多视频制作方法:

16 

17     1.将advanceVideoPlayer组件拖入舞台,加入所有视频。

 

  doubleClick-v2-as3.0 学习笔记(2)--Video相关  doubleClick-v2-as3.0 学习笔记(2)--Video相关   doubleClick-v2-as3.0 学习笔记(2)--Video相关  doubleClick-v2-as3.0 学习笔记(2)--Video相关

  1    2.vid_player.addEventListener(StudioVideoEvent.COMPLETE, videoCompleteHandler);

  2 

  3       function videoCompleteHandler(e:StudioVideoEvent) {

  4 

  5          if(autoPlayAll == false) {

  6 

  7              vid_player.seek(vid_player.getElapsedSeconds());//这个会造成进度条跳动

  8 

  9             videoMC.getPlaylist().getCurrentVideoController().setVideoCompleteDisplay(EnhancedVideoController.VIDEO_COMPLETE_SHOW_LAST_FRAME);//这个不会

 10 

 11               return;

 12 

 13             }

 14 

 15       }

 16 

 17       an_btn.addEventListener(MouseEvent.CLICK, switchVid );

 18 

 19           function   switchVid(){

 20 

 21              if (autoPlayAll) {

 22 

 23               autoPlayAll = false;

 24 

 25              vid_player.getPlaylist().setAutoAdvanceVideoOnComplete(false);//设置是否播完一个按顺序播放下一个,当设置完false后,第一次停止会停在下一个视频的第一帧。

 26 

 27          }

 28 

 29  

 30 

 31     3. vid_player.getPlaylist().skipTo(0);

 32 

 33         vid_player.getCurrentVideoController().unmute();

 34 

 35        vid_player.getCurrentVideoController().mute();

 36 

 37        vid_player.getCurrentVideoController().seek(0);

 38 

 39        vid_player.getCurrentVideoController().stop();

 40 

 41        vid_player.getCurrentVideoController().addEventListener(StudioVideoEvent.BUFFERED, onBuffer);

 42 

 43  

 44 

 45  

 46 

 47 //侦听缓冲和播放:

 48 

 49 import com.google.ads.studio.video.AbstractPlayerState;

 50 

 51 var state:AbstractPlayerState;

 52 

 53 vid.addEventListener(StudioVideoEvent.STATE_CHANGE, onStateChangeHandler);

 54 

 55 function onStateChangeHandler(e:StudioVideoEvent):void

 56 

 57 {

 58 

 59  

 60 

 61    state= vid.getCurrentVideoController().getPlayerState();

 62 

 63   // trace(state.getStateType());

 64 

 65 //PlayingState PausedState StoppedState 、BufferingState (当VideoPlayerAdvanced时)

 66 

 67 /// LoadingState,PlayingState PausedState StoppedState  (当VideoPlayer时)

 68 

 69    if (state.getStateType()=="BufferingState"||state.getStateType()==" LoadingState") 

 70 

 71    {

 72 

 73   loading.visible=true;

 74 

 75      txtAni.stop();

 76 

 77     

 78 

 79    }

 80 

 81    if (state.getStateType() =="PlayingState") 

 82 

 83    {

 84 

 85    loading.visible=false;

 86 

 87    txtAni.play();

 88 

 89    }

 90 

 91    if (state.getStateType() =="PausedState") 

 92 

 93    {

 94 

 95    loading.visible=false;

 96 

 97   txtAni.stop();

 98 

 99    }

100 

101 }

102 

103 

104 

105 //////////////////////////////////////////buffer Event

106 

107 VideoPlayer.getCurrentVideoController.addEventListener(StudioVideoEvent.BUFFERED,onBuffered);

108 

109 function onBuffered(e:StudioVideoEvent){

110 

111   trace("I have buffered!!!!!");///////////////////因为是用的VideoPlayer组件,不会trace出来

112 

113 }

114 

115  

116 

117 VideoPlayerAdvanced.getCurrentVideoController.addEventListener(StudioVideoEvent.BUFFERED,onBuffered);

118 

119 function onBuffered(e:StudioVideoEvent){

120 

121   trace("I have buffered!!!!!");///////////////////用VideoPlayerAdvanced,当第一次缓冲完可以派发出来,后面不会

122 

123 }

124 

125 

126 //////////========//////NETSTREAM_BUFFER_EMPTY and NETSTREAM_BUFFER_FULL

127 

128 这个两个事件侦听不到

你可能感兴趣的:(double)