@@ -4,103 +4,171 @@ CEF Based obs-studio browser plugin
4
4
5
5
## JS Bindings
6
6
7
- obs-browser provides a global object that allows access to some obs specific functionality from javascript .
7
+ obs-browser provides a global object that allows access to some OBS- specific functionality from JavaScript .
8
8
9
- ### Get OBS Studio Browser Plugin Version
10
- ```
11
- window.obsstudio.pluginVersion
12
- // => 1.24.0
13
- ```
9
+ ### Get Browser Plugin Version
14
10
15
- ### Register for visibility callbacks
16
- ```
11
+ ``` js
17
12
/**
18
- * onVisibilityChange gets callbacks when the visibility of the browser source changes in OBS
19
- *
20
- * @param {bool} visibility - True -> visible, False -> hidden
13
+ * @returns {number} OBS Browser plugin version
21
14
*/
22
- window.obsstudio.onVisibilityChange = function(visibility) {
23
-
24
- };
15
+ window .obsstudio .pluginVersion
16
+ // => 1.24.0
25
17
```
26
18
27
- ### Register for active/inactive callbacks
28
- ```
19
+ ### Register for event callbacks
20
+
21
+ ``` js
29
22
/**
30
- * onActiveChange gets callbacks when the active/inactive state of the browser source changes in OBS
31
- *
32
- * @param {bool} True -> active, False -> inactive
23
+ * @typedef {Object} OBSEvent
24
+ * @property {object} detail - data from event
33
25
*/
34
- window.obsstudio.onActiveChange = function(active) {
35
-
36
- };
37
- ```
38
26
39
- ### Register for scene change callbacks
40
- ```
41
- window.addEventListener('obsSceneChanged', function(evt) {
42
- var t = document.createTextNode(evt.detail.name);
43
- document.body.appendChild(t);
44
- });
27
+ window .addEventListener (' obsSceneChanged' , function (event ) {
28
+ var t = document .createTextNode (event .detail .name )
29
+ document .body .appendChild (t)
30
+ })
45
31
```
46
- #### Other events that are available
32
+
33
+ #### Available events
34
+
35
+ Descriptions for these events can be [ found here] ( https://obsproject.com/docs/reference-frontend-api.html?highlight=paused#c.obs_frontend_event ) .
36
+
37
+ * obsSceneChanged
38
+ * obsSourceVisibleChanged
39
+ * obsSourceActiveChanged
47
40
* obsStreamingStarting
48
41
* obsStreamingStarted
49
42
* obsStreamingStopping
50
43
* obsStreamingStopped
51
44
* obsRecordingStarting
52
45
* obsRecordingStarted
46
+ * obsRecordingPaused
47
+ * obsRecordingUnpaused
53
48
* obsRecordingStopping
54
49
* obsRecordingStopped
50
+ * obsReplaybufferStarting
51
+ * obsReplaybufferStarted
52
+ * obsReplaybufferStopping
53
+ * obsReplaybufferStopped
55
54
56
55
### Get the current scene
57
- ```
58
- window.obsstudio.getCurrentScene(function(data) { console.log(data); });
59
56
60
- data is a Javascript object containing the following properties:
61
- * width
62
- * height
63
- * name
57
+ ``` js
58
+ /**
59
+ * @typedef {Object} Scene
60
+ * @property {string} name - name of the scene
61
+ * @property {number} width - width of the scene
62
+ * @property {number} height - height of the scene
63
+ */
64
+
65
+ /**
66
+ * @param {function} callback
67
+ * @returns {Scene}
68
+ */
69
+ window .obsstudio .getCurrentScene (function (scene ) {
70
+ console .log (scene)
71
+ })
64
72
```
65
73
66
74
### Get OBS output status
75
+
76
+ ``` js
77
+ /**
78
+ * @typedef {Object} Status
79
+ * @property {boolean} recording - not affected by pause state
80
+ * @property {boolean} recordingPaused
81
+ * @property {boolean} streaming
82
+ * @property {boolean} replaybuffer
83
+ */
84
+
85
+ /**
86
+ * @param {function} callback
87
+ * @returns {Status}
88
+ */
89
+ window .obsstudio .getStatus (function (status ) {
90
+ console .log (status)
91
+ })
92
+ ```
93
+
94
+ ### Save OBS Replay Buffer
95
+
96
+ ``` js
97
+ /**
98
+ * Does not accept any parameters and does not return anything
99
+ */
100
+ window .obsstudio .saveReplayBuffer ()
67
101
```
68
- window.obsstudio.getStatus(function data) { console.log(data); });
69
102
70
- data is a Javascript object containing the following properties:
71
- * recording (true/false)
72
- * streaming (true/false)
73
- * replaybuffer (true/false)
103
+ ### Register for visibility callbacks
104
+
105
+ ** This method is legacy. Register an event listener instead.**
106
+
107
+ ``` js
108
+ /**
109
+ * onVisibilityChange gets callbacks when the visibility of the browser source changes in OBS
110
+ *
111
+ * @deprecated
112
+ * @see obsSourceVisibleChanged
113
+ * @param {boolean} visibility - True -> visible, False -> hidden
114
+ */
115
+ window .obsstudio .onVisibilityChange = function (visibility ) {
116
+
117
+ };
118
+ ```
119
+
120
+ ### Register for active/inactive callbacks
121
+
122
+ ** This method is legacy. Register an event listener instead.**
123
+
124
+ ``` js
125
+ /**
126
+ * onActiveChange gets callbacks when the active/inactive state of the browser source changes in OBS
127
+ *
128
+ * @deprecated
129
+ * @see obsSourceActiveChanged
130
+ * @param {bool} True -> active, False -> inactive
131
+ */
132
+ window .obsstudio .onActiveChange = function (active ) {
133
+
134
+ };
74
135
```
75
136
76
137
## Building on OSX
77
138
78
139
### Building CEF
140
+
79
141
#### Getting
142
+
80
143
* Download CEF Mac 64 from [ http://opensource.spotify.com/cefbuilds/index.html ] ( http://opensource.spotify.com/cefbuilds/index.html )
81
- * Use CEF branch 3112
144
+ * Use CEF branch 3770
82
145
* Extract and cd into the folder
83
146
84
147
#### Setting Up Project
85
- ```
148
+
149
+ ``` shell
86
150
mkdir build
87
151
cmake -D CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY=libc++ -G Xcode ..
88
152
open cef.xcodeproj/
89
153
```
90
154
91
155
#### Building
156
+
92
157
Build in Xcode (⌘+B)
93
158
94
159
TODO: tell user to move stuff, or update FindCEF.cmake
95
160
96
161
### Building OBS and obs-browser
162
+
97
163
#### Installing Dependencies
98
- ```
164
+
165
+ ``` shell
99
166
brew install ffmpeg x264 qt5 cmake
100
167
```
101
168
102
169
#### Setting Up Project
103
- ```
170
+
171
+ ``` shell
104
172
git clone --recursive https://github.com/jp9000/obs-studio.git
105
173
cd ./obs-studio
106
174
git clone
[email protected] :kc5nra/obs-browser.git ./plugins/obs-browser
@@ -112,17 +180,21 @@ open obs-studio.xcodeproj/
112
180
```
113
181
114
182
#### Building
183
+
115
184
Build in Xcode (⌘+B)
116
185
117
186
## Building on Windows
118
187
119
188
### Building CEF
189
+
120
190
#### Getting
191
+
121
192
* Download CEF Windows 64bit from [ http://opensource.spotify.com/cefbuilds/index.html ] ( http://opensource.spotify.com/cefbuilds/index.html )
122
193
* Use CEF branch 3440 or newer (3579 if you want shared texture support)
123
194
* Extract and cd into the folder
124
195
125
196
#### Setting Up the Project
197
+
126
198
* Run cmake-gui
127
199
* In "where is the source code", enter in the repo directory (example: C:/Users/User/Desktop/cef_binary_3.2743.1445.gdad7c0a_windows64).
128
200
* In "where to build the binaries", enter the repo directory path with the 'build' subdirectory (example: C:/Users/User/Desktop/cef_binary_3.2743.1445.gdad7c0a_windows64/build).
@@ -132,16 +204,21 @@ Visual Studio 12 2013 Win64, Visual Studio 14 2015 Win64 or Visual Studio 15 201
132
204
* Open cef.sln from the 'build' subdirectory
133
205
134
206
#### Building
207
+
135
208
* Build at least libcef_dll_wrapper (as Release), the rest is optional and are just clients to test with
136
209
137
210
### Building OBS and obs-browser
211
+
138
212
#### Follow the OBS build instructions
213
+
139
214
[ https://github.com/jp9000/obs-studio/wiki/Install-Instructions#windows ] ( https://github.com/jp9000/obs-studio/wiki/Install-Instructions#windows )
140
215
141
216
#### Setting Up Project
217
+
142
218
* Enable BUILD_BROWSER and set the CEF_ROOT_DIR path in cmake-gui for obs-studio (example: C:/Users/User/Desktop/cef_binary_3.2743.1445.gdad7c0a_windows64)
143
219
* * Press 'Generate' to generate Visual Studio project files in the 'build' subdirectory.
144
220
* Open obs-studio.sln from the 'build' subdirectory
145
221
146
222
#### Building
223
+
147
224
Build in Visual Studio
0 commit comments