..:: MX Studio Fóruns ::..: Ajuda - ..:: MX Studio Fóruns ::..

Jump to content

Publicidade




Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Ajuda Ajuda para carregar um video no site (palco)

#1 User is offline   BIORS 

  • Group: Membros
  • Posts: 1
  • Joined: 23-November 11

Posted 24 November 2011 - 10:58 AM

Ola pessoas, estou com um problema, to montando uma apresentação e necessito colocar um video na apresentação, o script que tenho carrega o video perfeitamente no desktop porem na web ele não carrega, alguém pode me ajudar?


Segue abaixo o script


_global.flvroot = this;

!_root.file ? file="americo.flv" : file=_root.file;

!_root.autoStart ? autoStart=false : autoStart=_root.autoStart;

w = Stage.width;
h = Stage.height;

!_root.video_fps ? video_fps=25 : video_fps=_root.video_fps;

!_root.confidence ? confidence=1.20 : confidence=_root.confidence;

nc = new NetConnection();
nc.connect(null);
ns = new NetStream(nc);

ns.setBufferTime(30);

this.createEmptyMovieClip("snd", 0);
snd.attachAudio(ns);
audio = new Sound(snd);
audio.setVolume(25);
unmuteBut._visible = false;

videoDisplay.attachVideo(ns);

ns.onMetaData = function(obj) {
this.totalTime = obj.duration;
};

ns.onStatus = function(object) {
if (object.code == "NetStream.Play.Start") {

w = videoDisplay.width;
h = videoDisplay.height;
} else if (object.code == "NetStream.Buffer.Full") {

w = videoDisplay.width;
h = videoDisplay.height;
} else if (object.code == "NetStream.Play.Stop") {

ns.seek(0);
ns.pause();
playBut._visible = true;
pauseBut._visible = false;
videoDisplay._visible = false;
imageClip._visible = true;
playText.txt.text = "click to play";
}
};

function playMovie() {
if (!isStarted) {
ns.play(file);

pauseMovie();

t0 = new Date().getTime();
intervalID = setInterval(function (obj) {
var loaded = obj.ns.bytesLoaded;
var total = obj.ns.bytesTotal;
var duration = parseInt(obj.ns.totalTime);
var confidence = obj.confidence;


if (loaded>25*1024 && typeof duration != "undefined" && !isNaN(duration)) {
var now = new Date().getTime();
your_bitrate = loaded/(now-t0)*1000;

loadingTime = total/your_bitrate-duration-(now-t0)/1000;
loadingTime = (loadingTime>0) ? Math.ceil(loadingTime*confidence) : 0;
ns.setBufferTime(loadingTime);

debug("loaded: "+loaded, true);
debug("total: "+total);
debug("duration: "+duration);your_bitrate
debug("your_bitrate: "+your_bitrate/1024);
debug("elapsed: "+((now-t0)/1000));
debug("loadingTime: "+loadingTime);
if (loadingTime == 0) {
ns.play(file);
clearInterval(intervalID);
}
}
}, 50, this);
playText.txt.text = "loading ...";
isStarted = true;
} else {
ns.pause();
}
pauseBut._visible = true;
playBut._visible = false;
videoDisplay._visible = true;
imageClip._visible = false;
}

function pauseMovie() {
ns.pause();
playBut._visible = true;
pauseBut._visible = false;
}

videoBg.onPress = function() {
if (pauseBut._visible == false) {
playMovie();
} else {
pauseMovie();
}
};

pauseBut.onPress = function() {
pauseMovie();
};

playBut.onPress = function() {
playMovie();
};

percentBar.onEnterFrame = function() {
loaded = this._parent.ns.bytesLoaded;
total = this._parent.ns.bytesTotal;
if (loaded == total && loaded>1000) {
audio.setVolume(25);
percentBar._width = bw;
delete this.onEnterFrame;
} else {
percentBar._width = int(bw*loaded/total);
}
};

progressBar.onEnterFrame = function() {
this._width = bw*ns.time/ns.totalTime;
};

centerBg.onPress = function() {
this.onEnterFrame = function() {
scl = this._xmouse*this._xscale/bw/100;
ns.seek(scl*ns.totalTime);
};
};

centerBg.onRelease = centerBg.onReleaseOutside=function () {
delete this.onEnterFrame;
pauseBut._visible == false ? videoDisplay.pause() : null;
};

muteBut.onPress = function() {
audio.setVolume(0);
unmuteBut._visible = true;
this._visible = false;
};

unmuteBut.onPress = function() {
audio.setVolume(25);
muteBut._visible = true;
this._visible = false;
};

videoDisplay._width = videoBg._width=w;
videoDisplay._height = videoBg._height=h-20;
playText._x = w/2;
playText._y = h/2-10;

leftBg._x = 0;
leftBg._y = h-20;
playBut._x = pauseBut._x=12;
playBut._y = pauseBut._y=h-10;

centerBg._x = percentBar._x=progressBar._x=backBar._x=21;
centerBg._y = h-20;
percentBar._y = progressBar._y=h-12;
bw = centerBg._width=percentBar._width=progressBar._width=w-42;

rightBg._x = w-21;
rightBg._y = h-20;
muteBut._x = unmuteBut._x=w-11;
muteBut._y = unmuteBut._y=h-10;

if (autoStart == true) {
playMovie();
} else {
pauseBut._visible = false;
imageStr = substring(file, 0, file.length-3)+"jpg";
imageClip.loadMovie(imageStr);
}

Valeu, fico no aguardo...
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic



Publicidade




1 User(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)