Bonjour à tous et toutes.

J'ai créé un projet sous flex et red5 qui permet d'enregistrer une vidéo depuis la webcam en streaming puis de l'envoyer sur le serveur pour la sauvegarder.

Cependant, je cherche à pouvoir relire la vidéo que je viens de faire dans le cadre de ma webcam, autrement dis à la place du flux de la webcam avant de l'envoyer sur mon serveur.

Si jamais un ou une d'entre vous avez une petite idée, elle sera la bienvenue surtout vu le peu de temps qu'il me reste pour y parvenir.

à vous.

Je vous fais parvenir mon code :

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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
			   creationComplete="init()">
 
	<fx:Script>
		<![CDATA[
			/**
			 * 
			 * Script pour la gestion de la caméra depuis le serveur red5.
			 *  
			 */
 
			import mx.controls.Alert;
 
			private var _resolutionWidth:int = 1024;
			private var _resolutionHeight:int = 960;
			private var _fps:int = 24;
			private var _cameraQuality:int = 100;
 
			private var _netConnect:NetConnection;
			private var _netStream:NetStream;
			private var _webcam:Camera;
			private var _mic:Microphone;
			private var _video:Video;
 
			/**
			 * Initialise la caméra avec le server red5
			 */
			public function init():void{
 
				/**
				 * Connection
				 */
				this._read.visible = false;
				this._netConnect = new NetConnection();		// Instanciation d'une nouvelle connection
				this._netConnect.connect("rtmp://localhost/oflaDemo");
				this._netConnect.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
				this._netConnect.client = this;
 
			}
 
 
			/**
			 * Stopper l'enregistrement de la caméra 
			 * @param event
			 */
			public function stop(event:Event):void{
				Alert.show('Stop call');
			}
 
			public function onNetStatus(event:NetStatusEvent):void {
				 if ( event.info.code == "NetConnection.Connect.Success" ) {
					 this._webcam = Camera.getCamera();
					 this._webcam.setMode(this._resolutionWidth,this._resolutionHeight,this._fps,true);
					 this._webcam.setQuality(0,this._cameraQuality);
					 this._mic = Microphone.getMicrophone();
					 this._netStream = new NetStream(this._netConnect);
					 this._netStream.attachCamera(this._webcam);
					 this._netStream.attachAudio(this._mic);
					 this._videoDisplay.attachCamera(this._webcam);
 
				 }
				 else{
				 	Alert.show('Error');
				 }
 			}
 
 
			public function publishCamera(e:Event):void {
				 if (this._rec.label=="Enregistrer") {
					 this._rec.label="Stopper";
					 this._netStream.publish("enregistrement", "record");
				 } else {
				 	this._netStream.close();
				 	this._videoDisplay.stop();
				 	this._read.visible = true;
			     	this._rec.visible=false;
 
				 }
 			}
 
 			public function displayPublishingVideo(e:Event):void {
 
 			}
 
			public function onBWDone():void {}
 
			public function isEnd():void{
				Alert.show('Fini');
			}
 
		]]>
	</fx:Script>
 
	<s:Panel width='322' height='275'>
		<mx:VideoDisplay id="_videoDisplay" width="320" height="240"/>
		<s:controlBarContent>
			<s:Button label="Enregistrer" id='_rec' height="35" click='publishCamera(event)'/>
			<s:Button label="Lire" id="_read" height="35" click="displayPublishingVideo(event)" />
		</s:controlBarContent>
 
 
	</s:Panel>
 
 
</s:Application>