Comunidad de diseño web y desarrollo en internet online

controles flv

Citar            
MensajeEscrito el 06 Ago 2008 11:49 am
Hola a todos,

He copiado el código que os pongo más abajo para contralar mi vídeo flv en mx.
El vídeo se carga correctamente, el play/pause funciona y la barra de carga también.
El botón de desplazamiento hace bien el arrastre, pero cuando lo suelto donde sea reinicia el vídeo.
Os pongo el código por si sabéis esxplicarme el por qué.
Muchas gracias!!!


//conección del video

var nc:NetConnection = new NetConnection();

nc.connect(null);

var ns:NetStream = new NetStream(nc);

miVideo.attachVideo(ns);

//cargo el video en mi servidor

ns.play("http://www.grafyline.com/invitado/bloque1.flv");

//este es el tiempo del buffer en segundos

ns.setBufferTime(10);

//mensaje cargando video dentro del mc bufferclip

ns.onStatus = function(info) {

if(info.code == "NetStream.Buffer.Full") {

bufferclip._visible = false;

}else{

bufferclip._visible = true;

}

}



//para el tiempo transcurrido del video

var time_interval:Number = setInterval(checkTime, 0, ns);
function checkTime(mi_ns:NetStream) {
var ns_seconds:Number = mi_ns.time;
var minutes:Number = Math.floor(ns_seconds/60);
var seconds = Math.floor(ns_seconds%60);
if (seconds<10) {
seconds = "0" + seconds;
}
timevid_txt.text = "0" + minutes + ":" + seconds;
}
//botones
_root.createEmptyMovieClip("vSound",_root.getNextHighestDepth());
vSound.attachAudio(ns);

var so:Sound = new Sound(vSound);

so.setVolume(100);

mute.onRollOver = function() {
if(so.getVolume()== 100) {
this.gotoAndStop("onOver");
}
else {
this.gotoAndStop("muteOver");
}
}

mute.onRollOut = function() {
if(so.getVolume()== 100) {
this.gotoAndStop("on");
}
else {
this.gotoAndStop("mute");
}
}

mute.onRelease = function() {
if(so.getVolume()== 100) {
so.setVolume(0);
this.gotoAndStop("muteOver");
}
else {
so.setVolume(100);
this.gotoAndStop("onOver");
}
}

playButton._visible= false;
playButton.onPress = function() {
ns.pause();
this._visible= false;
pauseButton._visible= true;
}
pauseButton.onPress = function() {
ns.pause();
this._visible= false;
playButton._visible= true;
}

//barra de desplazamiento
this.createEmptyMovieClip("vFrame",this.getNextHighestDepth());
vFrame.onEnterFrame = videoStatus;

var amountLoaded:Number;
var duration:Number;

ns["onMetaData"] = function(obj) {
duration = obj.duration;
}


function videoStatus() {
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
barra.progreso._width = amountLoaded * 140;
barra.scrub._x = ns.time / duration * 140;
}

var scrubInterval;

barra.scrub.onPress = function() {
vFrame.onEnterFrame = scrubit;
this.startDrag(false,0,this._y,140,this._y);
}

barra.scrub.onRelease = barra.scrub.onReleaseOutside = function() {
vFrame.onEnterFrame = videoStatus;
this.stopDrag();
}

function scrubit() {
ns.seek(Math.floor((barra.scrub._x/140)*duration));

Por Onexete

76 de clabLevel



Genero:Masculino  

msie7
Citar            
MensajeEscrito el 06 Ago 2008 01:26 pm
Te olvidaste de darle formato
Vuelve a postearlo correctamente

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.