Bonjour,

Je suis en pleine création d'un cabine d'enregistrement (as3) utilisant une webcam.

Lorsque je publie mon netstream avec le paramètre "record" tout va bien.
Cependant je permets à l'usager de pauser l'enregistrement pour le reprendre plus tard.
Grosso-modo je ferme le netstream lors de la pause. Quand l'usager appuie sur le bouton d'enregistrement à nouveau je recommence le publish mais avec le paramètre "append"

Problème: Mon enregistrement finale en format FLV éprouve une certaine lenteur. Quand je le visionne, il y a un long délais (un peu comme un lag) entre la partie avant la pause et la seconde qui se trouve à être le "append".

Voici les fonctions que j'utilise. Elle sont appelée par des listeners des boutons.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 
 public function startRecordFlv(camera:Camera, mic:Microphone, video:Video, timer:Timer, status:String):void
                {
                        if (status == "ready" || status == "pause")
                        {
                                timer.start();
                                this._changeStatus("recording");
 
                                this.setStreamName();
                                var recording:String = status == "ready" ? "record" : "append" ;
 
                                this._video = video;
                                trace(">> [STREAMING] => "+ recording + " => " + streamName);
 
                                this._ns.attachCamera(camera);
                                this._ns.attachAudio(mic);
                                this._ns.publish(streamName, recording);
                        } else {
                                trace(" >> ERROR : cannot start recoding on status:" + status);
                        }
                } // startRecordFlv()
 
  public function startPlayBack(video:Video, status:String):void
                {      
                        if ( status == "stop" || status == "playback")
                        {
                                // Close the connection and the stream if it's a double playback ( press two times on the button )
                                if ( status == "playback" )
                                {
                                        this._nsOut.close();
                                        this._ncOut.close();
                                }
 
                                this._changeStatus("playback");
 
                                video.clear();
 
                                this._ncOut.connect(null);
                                this._nsOut = new NetStream(this._ncOut);
 
                                this._nsOut.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
                                this._nsOut.addEventListener(SecurityErrorEvent.SECURITY_ERROR, ErrorsHandler.onSecurityError);
                                this._nsOut.addEventListener(AsyncErrorEvent.ASYNC_ERROR, ErrorsHandler.onAsyncError);
 
                                var ob:Object = new Object();
                                ob.onMetaData = onMetaDataHandler;
 
                                this._nsOut.client = ob;
                                this._nsOut.bufferTime = 5;
                                this._nsOut.receiveVideo(true);
                                this._nsOut.receiveAudio(true);
 
                                video.attachNetStream(this._nsOut);
                                this._nsOut.seek(0);
                                this._nsOut.play("http://" + this._serverCgf.host + ":5080/" + this._serverCgf.appName + "/streams/" + streamName + ".flv", -1, -1);
                        } else {
                                trace(">> ERROR : cannot start playback on status:" + status);
                        }
                } // startPlayBack()
 
 
                public function pauseFlv(timer:Timer, status:String):void
                {
                        if( status == "recording" )
                        {
                                this._ns.close();
                                timer.stop();
                                this._changeStatus("pause");
 
                        } else {
                                trace(">> ERROR : Cannot record on status : " + status);
                        }
                } // stopPlayback()
La fonction pause ne fontionne seulement que si le vidéo est en cours d'enregistrement.

NB: Les évènements ne sont pas tous présents, j'ai seulement mis ceux relatifs à mon problème.