setRightFill($shape->addFill(new SWFBitmap(fopen($img, "rb")))); $shape->drawLine(16,0); $shape->drawLine(0,16); $shape->drawLine(-16,0); $shape->drawLine(0,-16); return $shape; } function createButton($movie, $name, $loc, $script) { $button = new SWFButton(); $button->addShape(createImage("control_" . $name . ".png"), SWFBUTTON_UP); $button->addShape(createImage("control_" . $name . "_blue.png"), SWFBUTTON_DOWN | SWFBUTTON_HIT | SWFBUTTON_OVER); $button->addAction(new SWFAction($script), SWFBUTTON_HIT); $item=$movie->add($button); $item->moveto($loc,248); } Ming_setScale(20.0000000); ming_useswfversion(7); $movie = new SWFMovie(7); $movie->setDimension(320,270); $movie->setBackground(0,0,0); $movie->setRate(8); createButton($movie, "start", 10, "_root.videoStream.seek(0);"); createButton($movie, "pause", 40, "_root.videoStream.pause(true);"); createButton($movie, "play", 70, "_root.videoStream.pause(false);video_txt.text=''; nc.connect(null);"); $strAction =" this.createTextField('video_txt', 999, 120,120, 100, 100); video_txt.autoSize = 'left'; video_txt.multiline = true; video_txt.textColor = 0xeeeeee; video_txt.text='Appuyer sur play ...'; stop(); nc=new NetConnection(); nc.connect(null); videoStream=new NetStream(nc); videoStreamItem.attachVideo(videoStream); videoStream.setBufferTime(3); videoStream.play(_level0.video_path); videoStream.pause(); this.createEmptyMovieClip(\"progressBar_mc\", this.getNextHighestDepth()); progressBar_mc.createEmptyMovieClip(\"bar_mc\", progressBar_mc.getNextHighestDepth()); with (progressBar_mc.bar_mc) { _xscale=100; } progressBar_mc.createEmptyMovieClip(\"bar1_mc\", progressBar_mc.getNextHighestDepth()); with (progressBar_mc.bar1_mc) { lineStyle(1,0xFFFFFF,50,true, \"none\", \"round\", \"miter\", 1); moveTo(110,256); lineTo(311,256); } progressBar_mc.createEmptyMovieClip(\"stroke_mc\", progressBar_mc.getNextHighestDepth()); with (progressBar_mc.stroke_mc) { lineStyle(0, 0xFFFFFF); beginFill(0xFFFFFF); moveTo(110,251); lineTo(114,251); lineTo(114,261); lineTo(110,261); lineTo(110,251); endFill(); } var duree = 0; var mvt = false; videoStream.onMetaData = function(infoObject) { duree =infoObject['duration']; }; progressBar_mc.stroke_mc.onMouseDown = function () { if(_xmouse>=110 && _xmouse<=310 && _ymouse>=251 && _ymouse<=261) { var seconds = my_ns.time; var pctLu = Math.round(seconds/duree*100); var point = 110+2*pctLu; if(_xmouse>=point && _xmouse<=point+4) { mvt = true; } else { var pos = (_xmouse-110)/2; videoStream.seek(pos*duree/100); } } }; progressBar_mc.stroke_mc.onMouseUp = function () { if(mvt==true) { var pos = (_xmouse-110)/2; videoStream.seek(pos*duree/100); mvt=false; } }; progressBar_mc.stroke_mc.onMouseMove = function () { if(mvt==true) { var pos = (_xmouse-110)/2; videoStream.seek(pos*duree/100); } }; Mouse.addListener(progressBar_mc.stroke_mc); var loaded_interval2 = setInterval(checkVideoPlay, 10, videoStream); function checkVideoPlay(my_ns){ var seconds = my_ns.time; var pctLu = Math.round(seconds/duree*100); if(duree!=0) { progressBar_mc.stroke_mc.clear(); progressBar_mc.stroke_mc.lineStyle(0, 0xFFFFFF); progressBar_mc.stroke_mc.beginFill(0xFFFFFF); progressBar_mc.stroke_mc.moveTo(110+2*pctLu,251); progressBar_mc.stroke_mc.lineTo(114+2*pctLu,251); progressBar_mc.stroke_mc.lineTo(114+2*pctLu,261); progressBar_mc.stroke_mc.lineTo(110+2*pctLu,261); progressBar_mc.stroke_mc.lineTo(110+2*pctLu,251); progressBar_mc.stroke_mc.endFill(); } } var loaded_interval = setInterval(checkBytesLoaded, 500, videoStream); function checkBytesLoaded(my_ns) { var pctLoaded = Math.round(my_ns.bytesLoaded/my_ns.bytesTotal*100); progressBar_mc.bar_mc.clear(); progressBar_mc.bar_mc.beginFill(0xFFFFFF,50); progressBar_mc.bar_mc.moveTo(110,255); progressBar_mc.bar_mc.lineTo(110+2*pctLoaded,255); progressBar_mc.bar_mc.lineTo(110+2*pctLoaded,257); progressBar_mc.bar_mc.lineTo(110,257); progressBar_mc.bar_mc.lineTo(110,255); progressBar_mc.bar_mc.endFill(); if (pctLoaded>=100) { clearInterval(loaded_interval); } } "; $stream = new SWFVideoStream(); $stream->setDimension(320, 240); $item=$movie->add($stream); $item->setName("videoStreamItem"); $item->moveto(0,5); $movie->add(new SWFAction($strAction)); $movie->nextFrame(); $movie->save("player.swf"); ?>