-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
74 lines (54 loc) · 3.63 KB
/
README
File metadata and controls
74 lines (54 loc) · 3.63 KB
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
Recently I had to create a solution for live video camera streaming.
I tried different kinds of solutions, but still my biggest problem was the video recording.
The only possible normal way to record video that is h264, to be able to restream without transcoding and without installing software is Flash.
I'm really not used to with Flash, because I don't like it, but I had to deal with it, so I decided to push the code so other developers that don't like Flash either to use it with JavaScript.
The streaming solution that I'm using is Wowza media server + modified recorder and player, to be able to be controlled with JS.
You may also use it as an example how to communicate AS3 with JavaScript.
Recorder
=========
webcam.html is for everybody that is used to learn by an example, so you may check to code for documentation :)
JS functions:
//callback can be null
InitConnection(URL,callback)
URL -> The URL of the RTMP streaming server application
callback(bool) -> null or Callback function that will be invoked on failure/success
This is maybe the first function that you must call, it initiates a connection to URL and on status it invokes callback(bool) function
StartStreaming(StreamName,StreamType,callback)
StreamName -> Name of the stream that will be created in the streaming server
StreamType -> "live"|"record"|"append" most probably you will need live, for more information you may check the Flash documentation
callback -> Funtion name that will be invoked on failure
You must invoke StartStreaming after the connection is initated and the additional settings are set.
stopStreaming(callback)
callback -> the callback is invoked when the stream is stopped.
You may invoke stop streaming to stop the current stream, it is required if you want to change some of the stream options like the video quality or name of the stream.
// Stream settings
SetBufferingTime(BufferTime)
BufferTime -> (int) sets the recording buffering time (time to encode before start sending)
SetCameraMode(Width,Height,FPS)
Width -> (int) camera width
Height -> (int) camera height
FPS -> Frames per second of the recorded stream
SetQuality(Bandwidth,Quality,KeyFrameInterval)
Bandwidth -> (int) maximum bandwidth that can't be exceed, prefered 0 if you don't want to limit the bandwidth
Quality -> (int percents) higher value is better quality, lower is better compression from 0 to 100
KeyFrameInterval -> (int) after how many frames to put keyframe, this is mainly required when you want to make more files with lower length, mainly for low latency streams in DASH/HLS Streaming
SetH264Mode(Profile,Level)
Profile -> it sets baseline or main profile for h264
Level -> it sets the level
Please read more in the Flash documentation if you need to use it
SetMicrophone(codec,rate,gain,SilenceLevel,noiseSuppressionLevel,UseEchoSuppression)
This sets the audio codec and the microphone specific details
More information about the current parameters: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Microphone.html
================
Player:
StartPlay(URL,StreamName,ConnectionCallback,StreamCallback)
URL -> The URL of the RTMP streaming server application
StreamName -> Name of the stream that will be created in the streaming server
ConnectionCallback -> callback on connection to the RTMP server
StreamCallback -> callback on playing the stream
stopPlaying()
It stops playing the stream
SetBufferingTime(BufferTime)
BufferTime -> (int) sets the playing buffering time (time to decode before start playing)
SetVolume(Volume)
Volume -> (int percent) from 0 to 100 the volume level