Fonte do video display
<mx:VideoDisplay volume="{volumeSliderConferencia.value}"
autoPlay="false" live="true" x="10" y="0" id="videoPlayerConferencia"
width="352" height="240" backgroundColor="#965252"
maintainAspectRatio="false" borderStyle="solid" borderThickness="6"
borderColor="#A9A4A4"/>
<mx:ApplicationControlBar width="352"
id="controlMenu" top="240"
left="10" fillAlphas="[1.0, 1.0]" fillColors="[#FDFBFB, #767474]"
themeColor="#000000" alpha="0.42" color="#050606">
<mx:Button
id="confVideoPlayPauseButton" />
<mx:Label text="status:
{videoPlayerConferencia.state}"/>
<mx:Spacer width="100%"/>
<mx:Image width="16" height="16"
source="icones/
VolumeNormalRed.png"/>
<mx:HSlider
id="volumeSliderConferencia" liveDragging="true"
value=".75" minimum="0" maximum="1" height="34" width="72"/>
</mx:ApplicationControlBar>
<mx:Canvas x="10" y="233" width="352"
height="9" alpha="1.0"
backgroundAlpha="1.0" backgroundColor="#A9A4A4" borderColor="#A9A4A4"
borderStyle="solid">
</mx:Canvas>
<mx:HDividedBox left="370" right="10" top="0"
bottom="10">
<mx:Panel layout="absolute"
title="Chat" width="80%"
height="100%" borderColor="#A9A4A4">
<mx:TextArea id="messageArea"
wordWrap="true" editable="false"
enabled="true" left="0" right="0" bottom="41" top="0"
borderStyle="none"/>
<mx:TextInput left="4"
bottom="3" right="73" fontSize="12"
borderStyle="inset" id="sendMessageInput" text="Olá !"/>
<mx:Button label="Enviar"
right="4" bottom="5"
id="confSendButton" click="sendMessage()"/>
</mx:Panel>
</mx:HDividedBox>
<mx:Panel layout="absolute" id="usuario"
title="Usuários"
width="352" left="10" top="293" bottom="10" borderColor="#A9A4A4">
<mx:List id="usersList"
borderStyle="none" left="10" top="0"
bottom="0" right="0"/>
</mx:Panel>
// ActionScript file que controla a videodisplay
import flash.events.MouseEvent;
import mx.events.VideoEvent;
import mx.formatters.DateFormatter;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.http.mxml.HTTPService;
private var videoLength:String;
private var start:Date;
private var timeDisplayFormatter:DateFormatter;
private var seekTo:Number;
private var playlist:XMLList;
private var playlistCursor:uint;
[Bindable]
private var videoFileTotalBytes:Number;
public function stopGaleria():void{
if(myVideoDisplay.playing){
myVideoDisplay.pause();
}
}
public function startGaleria():void{
videoFileTotalBytes = this.myVideoDisplay.bytesTotal;
start = new Date("1/1/2000");
timeDisplayFormatter = new DateFormatter();
this.myVideoDisplay.addEventListener(VideoEvent.READY, videoReady);
this.myVideoDisplay.addEventListener(VideoEvent.COMPLETE,
videoComplete);
this.myVideoDisplay.addEventListener(VideoEvent.PLAYHEAD_UPDATE,
updateTimeDisplay);
this.btn_next.addEventListener(MouseEvent.CLICK,
playlistControlsHandler);
this.btn_previous.addEventListener(MouseEvent.CLICK,
playlistControlsHandler);
btn_playToggle.addEventListener(MouseEvent.CLICK,togglePlayback);
btn_stopToggle.addEventListener(MouseEvent.CLICK,toogleStop);
loadPlaylist();
}
private function playlistControlsHandler(event:MouseEvent):void{
switch(event.currentTarget.label){
case 'Next':
if(playlistCursor<playlist.length() -1){
if(myVideoDisplay.playing){
myVideoDisplay.pause();
}
this.myVideoDisplay.playheadTime = 0;
playlistCursor ++;
playVideo();
}
break;
case 'Prev':
if(playlistCursor - 1>=0){
if(myVideoDisplay.playing){
myVideoDisplay.pause();
}
this.myVideoDisplay.playheadTime = 0;
playlistCursor --;
playVideo();
}
break;
default:
break;
}
}
private function loadPlaylist():void{
playlistCursor = 0;
var playlistService:HTTPService = new HTTPService();
playlistService.url = "galeria/playlist.xml";
playlistService.resultFormat = "xml";
playlistService.showBusyCursor = true;
playlistService.addEventListener(ResultEvent.RESULT,
onPlaylistResult);
playlistService.addEventListener(FaultEvent.FAULT, onFault);
playlistService.send();
}
private function onPlaylistResult(event:ResultEvent):void{
var resultXML:XML = new XML(event.result);
playlist = new XMLList(resultXML.video);
playVideo();
}
private function playVideo():void{
this.myVideoDisplay.source= this.playlist[playlistcurso...@file;
}
private function onFault(event:FaultEvent):void{
trace(event.fault);
}
private function toogleStop(event:MouseEvent):void{
this.myVideoDisplay.stop();
}
private function togglePlayback(event:MouseEvent):void{
if(this.myVideoDisplay.playing){
this.myVideoDisplay.pause();
}else if(this.myVideoDisplay.source){
this.myVideoDisplay.play();
}
}
private function videoComplete(event:VideoEvent):void{
if(this.playlistCursor< this.playlist.length() -1){
this.myVideoDisplay.playheadTime = 0;
this.playlistCursor ++;
this.playVideo();
}
}
private function videoReady(event:VideoEvent):void{
timeDisplayFormatter.formatString = "J:NN:SS";
var totalTime:Date = new Date(start.getTime() +
(this.myVideoDisplay.totalTime * 1000));
this.videoLength = timeDisplayFormatter.format(totalTime);
}
private function updateTimeDisplay(event:VideoEvent):void{
timeDisplayFormatter.formatString = "N:SS";
var currentTime:Date = new Date(start.getTime()+ (event.playheadTime
* 1000));
tf_playtimeDisplay.text = timeDisplayFormatter.format(currentTime) +
"/" + this.videoLength;
}
Ta ai, o fonte primeiro o mxml com o player, e abaixo o actionscript
que trata o player.
Alguns fatos interessantes.
Se eu limpo o cache do meu navegador, o sistema funciona direitinho.
Se eu rodo o sistema, algumas vezes ele da erro outras não, isto sem
eu mexer no codigo.
On 26 fev, 10:39, Chacal Army <[email protected]> wrote:
> tem como colocar seu fonte?
--~--~---------~--~----~------------~-------~--~----~
Você recebeu esta mensagem porque está inscrito na lista "flexdev"
Para enviar uma mensagem, envie um e-mail para [email protected]
Para sair da lista, envie um email em branco para
[email protected]
Mais opções estão disponíveis em http://groups.google.com/group/flexdev
-~----------~----~----~----~------~----~------~--~---