Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it
    Registrato dal
    Feb 2003
    Messaggi
    178

    AS2 - Sincronia di due player che trasmettono lo stesso video

    Ciao a tutti.
    Sto usando l'oggetto video per tramettere in streaming lo stesso video in flv all'interno di due istanze (mainVideo e videoBg) dello stesso movieclip che contengono il suddetto oggetto video (videoPlayer).

    Codice PHP:
    var nc:NetConnection = new NetConnection();
    var 
    nc2:NetConnection = new NetConnection();
    nc.connect(null);
    nc2.connect(null);
    var 
    ns:NetStream = new NetStream(nc);
    var 
    ns2:NetStream = new NetStream(nc2);
    mainVideo.videoPlayer.attachVideo(ns);
    videoBg.videoPlayer.attachVideo(ns2);
    ns.setBufferTime(10);
    ns2.setBufferTime(10);


    ns.onStatus = function(info) {
        if(
    info.code == "NetStream.Play.Stop") {
            
    ns.seek(0);
            
    ns2.seek(0);
        }
    //loop del video
    }

    playButton.onRelease = function() {
        
    ns.pause(false);
        
    ns2.pause(false);
    }
    stopButton.onRelease = function() {
        
    ns.pause(true);
        
    ns2.pause(true);
    }


    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;
        
    loader.loadbar._width amountLoaded 234;
        
    loader.scrub._x ns.time duration 233 ;
    }

    var 
    scrubInterval;

    loader.scrub.onPress = function() {
        
    vFrame.onEnterFrame scrubit;
        
    this.startDrag(false,-1,this._y,233,this._y);
    }

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

    function 
    scrubit() {
        
    ns.seek(Math.floor((loader.scrub._x/233)*duration));
        
    ns2.seek(Math.floor((loader.scrub._x/233)*duration));
    }

    function 
    pauseIt() {
        
    ns.pause();
        
    ns2.pause();
    }

    function 
    stopIt() {
        
    ns.seek(0);
        
    ns.pause();
        
    ns2.seek(0);
        
    ns2.pause();
    }
    //volume dei due video
    this.createEmptyMovieClip("vSound",1)
    vSound.attachAudio(ns);
    var 
    so:Sound = new Sound(vSound);
    so.setVolume(100);
    this.createEmptyMovieClip("vSound2",2);
    vSound2.attachAudio(ns2);
    var 
    so2:Sound = new Sound(vSound2);
    so2.setVolume(0);


    var 
    pathVideo "prova.flv"
    ns2.play(pathVideo);
    ns.play(pathVideo); 
    Ho creato una barra progressiva(loader) che contiene un cursore (scrub) e una barra che indica la quantità di video scaricata (loadbar).

    Come faccio a fare in modo che i video partano all'unisono? In sincronia?
    Come si fa a fare in modo che il primo dei due che viene caricato attende il secondo per partire per poi partire insieme?

    NB: Non appena agisco sul cursore i due video si dispongono ai medesimi secondi di proiezione!
    Iohannes

  2. #2
    Utente di HTML.it
    Registrato dal
    Feb 2003
    Messaggi
    178
    Help me please!!!!
    Iohannes

  3. #3
    Utente di HTML.it
    Registrato dal
    Feb 2003
    Messaggi
    178
    Aiuto vi prego!!!! And80!!!!! Aiutoooooooo!!!!
    Iohannes

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.