Comunidad de diseño web y desarrollo en internet online

Hola alguien me puede dar una mano para pausar mi galeria

Citar            
MensajeEscrito el 05 Feb 2010 04:28 am
Hola alguien me puede dar una mano para pausar mi galeria de videos streaming.

Se q no debe ser dificl la solucion pero a estas horas ya no me da mas el bocho, espero que alguien pueda ayudarme dejo el codigo por si a alguien le interesa

Lo que quiero lograr es que arranque pausado no en play

muchas gracias

// LOAD VIDEO STREAM
//
// Reset video and controls
resetVideo = function () {
durationDisplay = "0:00";
controls_mc.progress_mc.buffer_mc._xscale = 0;
controls_mc.progress_mc.played_mc._xscale = 0;
videoEnd = false;
doPlay();
};
resetVideo();
// Video stream
var nc:NetConnection = new NetConnection(this);
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.setBufferTime(defaultBuffer);
// Attach video stream
video_holder.videoClip.attachVideo(ns);
// Attach audio stream
video_holder.attachAudio(ns);
video_holder.videoClip.smoothing = true;
loadVideo = function () {
resetVideo();
ns.play(toLoad);
ns.onMetaData = function(obj) {
duration = obj["duration"];
var minutes2:Number = Math.round(duration/60);
var seconds2 = Math.round(duration%60);
if (seconds2<10) {
seconds2 = "0"+seconds2;
}
durationDisplay = minutes2+":"+seconds2;
};
};
//
// THUMB PRESS (LOADS VIDEO)
//
_global.thumbPress = function(obj) {
toLoad = xmlNode.childNodes[galleryID].childNodes[obj.ID].attributes.VideoClip;
videoTitle.text = xmlNode.childNodes[galleryID].childNodes[obj.ID].attributes.Title;
galleryTitle.text = xmlNode.childNodes[galleryID].attributes.Name;
loadVideo();
};
//
// SOUND CONTROLS
//
controls_mc.sound_time_mc.bttnSound.mc_soundLevel._visible = false;
controls_mc.sound_time_mc.bttnSound.bttn.onRollOver = function() {
this._parent.mc_soundLevel._visible = true;
};
controls_mc.sound_time_mc.bttnSound.bttn.onRollOut = controls_mc.sound_time_mc.bttnSound.bttn.onDragOut=function () {
if (!this._parent.mc_soundLevel.hitTest(_xmouse, _ymouse, true)) {
this._parent.mc_soundLevel._visible = false;
}
};
controls_mc.sound_time_mc.bttnSound.mc_soundLevel.onRollOut = function() {
this._visible = false;
};
// Adjust volume on slider press
var video_sound:Sound = new Sound(video_holder);
video_sound.setVolume(defaultVolume);
controls_mc.sound_time_mc.bttnSound.mc_soundLevel.mc_bar._yscale = defaultVolume;
controls_mc.sound_time_mc.bttnSound.mc_soundLevel.onPress = function() {
controls_mc.sound_time_mc.bttnSound.mc_soundLevel.onEnterFrame = function() {
if (this._ymouse<0) {
volumeTo = 0;
} else if (this._ymouse>this.bar._height) {
volumeTo = 100;
} else {
volumeTo = (this._ymouse/this.bar._height)*100;
}
this.mc_bar._yscale = 100-volumeTo;
video_sound.setVolume(100-volumeTo);
};
};
// Adjust volume on slider release
controls_mc.sound_time_mc.bttnSound.mc_soundLevel.onRelease = controls_mc.sound_time_mc.bttnSound.mc_soundLevel.onReleaseOutside=function () {
delete controls_mc.sound_time_mc.bttnSound.mc_soundLevel.onEnterFrame;
this._visible = false;
};
//
// PLAY / PAUSE CONTROLS
//
// Button functions
doPlay = function () {
ns.pause(false);
controls_mc.bttnPlay.icon_mc.gotoAndStop(1);
};
doPause = function () {
ns.pause(true);
controls_mc.bttnPlay.icon_mc.gotoAndStop(2);
};
doRestart = function () {
ns.seek(0);
controls_mc.bttnPlay.icon_mc.gotoAndStop(1);
ns.pause(false);
};
// Play button
controls_mc.bttnPlay.bttn.onPress = function() {
if (controls_mc.bttnPlay.icon_mc._currentframe == 1) {
doPause();
} else {
if (ns.time>=duration && duration != undefined) {
doRestart();
} else {
doPlay();
}
}
};
// Rewind button
controls_mc.bttnRewind.bttn.onPress = function() {
doRestart();
};
//
// PROGRESS BAR CONTROLS
//
// Adjust playhead on progress bar press
controls_mc.progress_mc.onPress = function() {
controls_mc.progress_mc.onEnterFrame = function() {
if ((this._xmouse*this._xscale)/100<0) {
this.percentage = 0;
} else if ((this._xmouse*this._xscale)/100>this._width && this.buffer_mc._xscale == 100) {
this.percentage = 100;
} else {
this.percentage = Math.round((this._xmouse*this._xscale)/100/this._width*100);
}
ns.pause(true);
seekTime = this.percentage/100*duration;
seekTime = Math.round(seekTime*100)/100;
ns.seek(seekTime);
};
};
// Adjust playhead on progress bar release
controls_mc.progress_mc.onRelease = controls_mc.progress_mc.onReleaseOutside=function () {
if (this.percentage == 100) {
doPause();
} else {
doPlay();
}
delete controls_mc.progress_mc.onEnterFrame;
};
onEnterFrame = function () {
// Get video stream bytes loaded
percentage = Math.round(ns.bytesLoaded/ns.bytesTotal*100);
controls_mc.progress_mc.buffer_mc._xscale = percentage;
// Get video time
ns_seconds = ns.time;
minutes = Math.floor(ns_seconds/60);
seconds = Math.floor(ns_seconds%60);
if (seconds<10) {
seconds = "0"+seconds;
}
controls_mc.sound_time_mc.time_txt.text = minutes+":"+seconds+" / "+durationDisplay;
// Progress bar position
if (ns.time>=duration && duration != undefined) {
controls_mc.progress_mc.played_mc._xscale = 100;
if (videoEnd == false) {
controls_mc.bttnPlay.icon_mc.gotoAndStop(2);
videoEnd = true;
}
} else {
controls_mc.progress_mc.played_mc._xscale = Math.round(ns.time*100/duration);
videoEnd = false;
}
};

Por amnesia

2 de clabLevel



 

chrome
Citar            
MensajeEscrito el 05 Feb 2010 05:04 am
hola amnesia!! A ver... me da la impresion que tendrias que cambiar esto:

(Primera parte)
// LOAD VIDEO STREAM
//
// Reset video and controls
resetVideo = function () {
durationDisplay = "0:00";
controls_mc.progress_mc.buffer_mc._xscale = 0;
controls_mc.progress_mc.played_mc._xscale = 0;
videoEnd = false;
doPlay();// "ACA, BORRAS doPlay() y escribes stop();
};

Fijate si está bien. Pero la verdad que es compicadito... Comom lograste tener este chorizo de codigo? Un abrazo!

Por Peladogali

2 de clabLevel



 

firefox
Citar            
MensajeEscrito el 05 Feb 2010 08:56 am
gracias por tu respuesta, pero no es esa la solucion creo que voy a simular la carga con un cuadro en negro
como para que arranquye detenido, mcuhas gracias por tu ayuda

Por amnesia

2 de clabLevel



 

chrome

 

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