OBS-Browser memperkenalkan sumber browser lintas platform, ditenagai oleh CEF (Chromium Embedded Framework), ke OBS Studio. Sumber browser memungkinkan pengguna untuk mengintegrasikan overlay berbasis web ke dalam adegan mereka, dengan akses lengkap ke API web modern.
Selain itu, OBS-Browser memungkinkan integrasi layanan (menghubungkan layanan pihak ketiga) dan browser docks (halaman web dimuat ke antarmuka itu sendiri) pada semua platform yang didukung, kecuali untuk Wayland (Linux).
Plugin ini disertakan secara default pada paket resmi di Windows, MacOS, Ubuntu PPA dan Flatpak resmi (sebagian besar distribusi Linux).
OBS-Browser menyediakan objek global yang memungkinkan akses ke beberapa fungsionalitas khusus OBS dari JavaScript. Ini dapat digunakan untuk membuat overlay yang beradaptasi secara dinamis dengan perubahan OBS.
Jika Anda menggunakan TypeScript, ketik definisi untuk binding OBS-browser tersedia melalui NPM dan benang.
# npm
npm install --save-dev @types/obs-studio
# yarn
yarn add --dev @types/obs-studio
/**
* @returns {string} OBS Browser plugin version
*/
window . obsstudio . pluginVersion
// => 2.17.0
/**
* @callback EventListener
* @param {CustomEvent} event
*/
/**
* @param {string} type
* @param {EventListener} listener
*/
window . addEventListener ( 'obsSceneChanged' , function ( event ) {
var t = document . createTextNode ( event . detail . name )
document . body . appendChild ( t )
} )
Deskripsi untuk acara ini dapat ditemukan di sini.
Diperlukan izin: Tidak ada
/**
* @typedef {number} Level - The level of permissions. 0 for NONE, 1 for READ_OBS (OBS data), 2 for READ_USER (User data), 3 for BASIC, 4 for ADVANCED and 5 for ALL
*/
/**
* @callback LevelCallback
* @param {Level} level
*/
/**
* @param {LevelCallback} cb - The callback that receives the current control level.
*/
window . obsstudio . getControlLevel ( function ( level ) {
console . log ( level )
} )
Izin diperlukan: read_obs
/**
* @typedef {Object} Status
* @property {boolean} recording - not affected by pause state
* @property {boolean} recordingPaused
* @property {boolean} streaming
* @property {boolean} replaybuffer
* @property {boolean} virtualcam
*/
/**
* @callback StatusCallback
* @param {Status} status
*/
/**
* @param {StatusCallback} cb - The callback that receives the current output status of OBS.
*/
window . obsstudio . getStatus ( function ( status ) {
console . log ( status )
} )
Diperlukan izin: read_user
/**
* @typedef {Object} Scene
* @property {string} name - name of the scene
* @property {number} width - width of the scene
* @property {number} height - height of the scene
*/
/**
* @callback SceneCallback
* @param {Scene} scene
*/
/**
* @param {SceneCallback} cb - The callback that receives the current scene in OBS.
*/
window . obsstudio . getCurrentScene ( function ( scene ) {
console . log ( scene )
} )
Diperlukan izin: read_user
/**
* @callback ScenesCallback
* @param {string[]} scenes
*/
/**
* @param {ScenesCallback} cb - The callback that receives the scenes.
*/
window . obsstudio . getScenes ( function ( scenes ) {
console . log ( scenes )
} )
Diperlukan izin: read_user
/**
* @callback TransitionsCallback
* @param {string[]} transitions
*/
/**
* @param {TransitionsCallback} cb - The callback that receives the transitions.
*/
window . obsstudio . getTransitions ( function ( transitions ) {
console . log ( transitions )
} )
Diperlukan izin: read_user
/**
* @callback TransitionCallback
* @param {string} transition
*/
/**
* @param {TransitionCallback} cb - The callback that receives the transition currently set.
*/
window . obsstudio . getCurrentTransition ( function ( transition ) {
console . log ( transition )
} )
Izin diperlukan: Dasar
/**
* Does not accept any parameters and does not return anything
*/
window . obsstudio . saveReplayBuffer ( )
Izin diperlukan: Lanjutan
/**
* Does not accept any parameters and does not return anything
*/
window . obsstudio . startReplayBuffer ( )
Izin diperlukan: Lanjutan
/**
* Does not accept any parameters and does not return anything
*/
window . obsstudio . stopReplayBuffer ( )
Izin diperlukan: Lanjutan
/**
* @param {string} name - Name of the scene
*/
window . obsstudio . setCurrentScene ( name )
Izin diperlukan: Lanjutan
/**
* @param {string} name - Name of the transition
*/
window . obsstudio . setCurrentTransition ( name )
Diperlukan izin: Semua
/**
* Does not accept any parameters and does not return anything
*/
window . obsstudio . startStreaming ( )
Diperlukan izin: Semua
/**
* Does not accept any parameters and does not return anything
*/
window . obsstudio . stopStreaming ( )
Diperlukan izin: Semua
/**
* Does not accept any parameters and does not return anything
*/
window . obsstudio . startRecording ( )
Diperlukan izin: Semua
/**
* Does not accept any parameters and does not return anything
*/
window . obsstudio . stopRecording ( )
Diperlukan izin: Semua
/**
* Does not accept any parameters and does not return anything
*/
window . obsstudio . pauseRecording ( )
Diperlukan izin: Semua
/**
* Does not accept any parameters and does not return anything
*/
window . obsstudio . unpauseRecording ( )
Diperlukan izin: Semua
/**
* Does not accept any parameters and does not return anything
*/
window . obsstudio . startVirtualcam ( )
Diperlukan izin: Semua
/**
* Does not accept any parameters and does not return anything
*/
window . obsstudio . stopVirtualcam ( )
Metode ini adalah warisan. Daftarkan pendengar acara sebagai gantinya.
/**
* onVisibilityChange gets callbacks when the visibility of the browser source changes in OBS
*
* @deprecated
* @see obsSourceVisibleChanged
* @param {boolean} visibility - True -> visible, False -> hidden
*/
window . obsstudio . onVisibilityChange = function ( visibility ) {
} ;
Metode ini adalah warisan. Daftarkan pendengar acara sebagai gantinya.
/**
* onActiveChange gets callbacks when the active/inactive state of the browser source changes in OBS
*
* @deprecated
* @see obsSourceActiveChanged
* @param {bool} True -> active, False -> inactive
*/
window . obsstudio . onActiveChange = function ( active ) {
} ;
OBS-Browser termasuk integrasi dengan permintaan vendor Obs-Websocket. Nama vendor yang akan digunakan adalah obs-browser
, dan permintaan yang tersedia adalah:
emit_event
- mengambil event_name
dan? parameter event_data
. Memancarkan acara khusus untuk semua sumber browser. Untuk berlangganan acara, lihat di siniTidak ada acara vendor yang tersedia saat ini.
Browser OBS tidak dapat dibangun mandiri. Ini dibangun sebagai bagian dari OBS Studio.
Dengan mengikuti instruksi, ini akan memungkinkan sumber browser & dock browser khusus di ketiga platform. Baik BUILD_BROWSER
dan CEF_ROOT_DIR
diperlukan.
Ikuti instruksi build dan pastikan untuk mengunduh pembungkus CEF dan atur CEF_ROOT_DIR
di cmake untuk menunjuk ke pembungkus yang diekstraksi.
Gunakan skrip build penuh macOS. Ini akan secara otomatis mengunduh & mengaktifkan browser OBS.
Ikuti opsi build dan pilih opsi "jika membangun dengan sumber browser". Ini termasuk langkah -langkah untuk mengunduh/mengekstrak pembungkus CEF, dan mengatur variabel cmake yang diperlukan.