OBS-BROWSER แนะนำแหล่งเบราว์เซอร์ข้ามแพลตฟอร์มขับเคลื่อนโดย CEF (กรอบการฝังตัวของโครเมียม) ไปยังสตูดิโอ OBS แหล่งที่มาของเบราว์เซอร์ช่วยให้ผู้ใช้สามารถรวมการซ้อนทับบนเว็บเข้ากับฉากของพวกเขาด้วยการเข้าถึงเว็บ API ที่ทันสมัยอย่างสมบูรณ์
นอกจากนี้ OBS-Browser ยังเปิดใช้งานการรวมบริการ (เชื่อมโยงบริการบุคคลที่สาม) และท่าเรือเบราว์เซอร์ (เว็บเพจที่โหลดลงในอินเทอร์เฟซเอง) บนแพลตฟอร์มที่รองรับทั้งหมดยกเว้น Wayland (Linux)
ปลั๊กอินนี้รวมอยู่ในค่าเริ่มต้น ในแพ็คเกจอย่างเป็นทางการบน Windows, MacOS, Ubuntu PPA และ Flatpak อย่างเป็นทางการ (การแจกแจง Linux ส่วนใหญ่)
OBS-BROWSER จัดเตรียมวัตถุระดับโลกที่อนุญาตให้เข้าถึงฟังก์ชันการทำงานเฉพาะของ OBS จาก JavaScript สิ่งนี้สามารถใช้เพื่อสร้างการซ้อนทับที่ปรับให้เข้ากับการเปลี่ยนแปลงแบบไดนามิกใน OBS
หากคุณใช้ typeScript ให้พิมพ์คำจำกัดความสำหรับการผูก OBS-BROWSER จะมีให้ผ่าน NPM และเส้นด้าย
# 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 )
} )
คำอธิบายสำหรับเหตุการณ์เหล่านี้สามารถพบได้ที่นี่
ต้องได้รับอนุญาต: ไม่มี
/**
* @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 )
} )
ต้องได้รับอนุญาต: 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 )
} )
ต้องได้รับอนุญาต: 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 )
} )
ต้องได้รับอนุญาต: read_user
/**
* @callback ScenesCallback
* @param {string[]} scenes
*/
/**
* @param {ScenesCallback} cb - The callback that receives the scenes.
*/
window . obsstudio . getScenes ( function ( scenes ) {
console . log ( scenes )
} )
ต้องได้รับอนุญาต: read_user
/**
* @callback TransitionsCallback
* @param {string[]} transitions
*/
/**
* @param {TransitionsCallback} cb - The callback that receives the transitions.
*/
window . obsstudio . getTransitions ( function ( transitions ) {
console . log ( transitions )
} )
ต้องได้รับอนุญาต: 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 )
} )
ต้องได้รับอนุญาต: พื้นฐาน
/**
* Does not accept any parameters and does not return anything
*/
window . obsstudio . saveReplayBuffer ( )
การอนุญาตที่จำเป็น: ขั้นสูง
/**
* Does not accept any parameters and does not return anything
*/
window . obsstudio . startReplayBuffer ( )
การอนุญาตที่จำเป็น: ขั้นสูง
/**
* Does not accept any parameters and does not return anything
*/
window . obsstudio . stopReplayBuffer ( )
การอนุญาตที่จำเป็น: ขั้นสูง
/**
* @param {string} name - Name of the scene
*/
window . obsstudio . setCurrentScene ( name )
การอนุญาตที่จำเป็น: ขั้นสูง
/**
* @param {string} name - Name of the transition
*/
window . obsstudio . setCurrentTransition ( name )
ต้องได้รับอนุญาต: ทั้งหมด
/**
* Does not accept any parameters and does not return anything
*/
window . obsstudio . startStreaming ( )
ต้องได้รับอนุญาต: ทั้งหมด
/**
* Does not accept any parameters and does not return anything
*/
window . obsstudio . stopStreaming ( )
ต้องได้รับอนุญาต: ทั้งหมด
/**
* Does not accept any parameters and does not return anything
*/
window . obsstudio . startRecording ( )
ต้องได้รับอนุญาต: ทั้งหมด
/**
* Does not accept any parameters and does not return anything
*/
window . obsstudio . stopRecording ( )
ต้องได้รับอนุญาต: ทั้งหมด
/**
* Does not accept any parameters and does not return anything
*/
window . obsstudio . pauseRecording ( )
ต้องได้รับอนุญาต: ทั้งหมด
/**
* Does not accept any parameters and does not return anything
*/
window . obsstudio . unpauseRecording ( )
ต้องได้รับอนุญาต: ทั้งหมด
/**
* Does not accept any parameters and does not return anything
*/
window . obsstudio . startVirtualcam ( )
ต้องได้รับอนุญาต: ทั้งหมด
/**
* Does not accept any parameters and does not return anything
*/
window . obsstudio . stopVirtualcam ( )
วิธีนี้เป็นมรดก ลงทะเบียนผู้ฟังเหตุการณ์แทน
/**
* 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 ) {
} ;
วิธีนี้เป็นมรดก ลงทะเบียนผู้ฟังเหตุการณ์แทน
/**
* 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 รวมถึงการรวมเข้ากับคำขอของผู้ขายของ OBS-WEBSOCKET ชื่อผู้ขายที่ใช้คือ obs-browser
และคำขอที่มีอยู่คือ:
emit_event
- ใช้ event_name
และ? พารามิเตอร์ event_data
ปล่อยเหตุการณ์ที่กำหนดเองไปยังแหล่งเบราว์เซอร์ทั้งหมด เพื่อสมัครสมาชิกเหตุการณ์ดูที่นี่ไม่มีกิจกรรมผู้ขายที่มีอยู่ในขณะนี้
เบราว์เซอร์ OBS ไม่สามารถสร้างแบบสแตนด์อโลนได้ มันถูกสร้างขึ้นเป็นส่วนหนึ่งของ Obs Studio
โดยทำตามคำแนะนำสิ่งนี้จะเปิดใช้งานแหล่งที่มาของเบราว์เซอร์และเบราว์เซอร์ที่กำหนดเองบนแพลตฟอร์มทั้งสามแพลตฟอร์ม จำเป็นต้องใช้ทั้ง BUILD_BROWSER
และ CEF_ROOT_DIR
ทำตามคำแนะนำการสร้างและอย่าลืมดาวน์โหลด CEF wrapper และตั้งค่า CEF_ROOT_DIR
ใน CMAKE เพื่อชี้ไปที่ Wrapper ที่แยกออกมา
ใช้สคริปต์บิลด์เต็มรูปแบบ MacOS สิ่งนี้จะดาวน์โหลดและเปิดใช้งานเบราว์เซอร์ OBS โดยอัตโนมัติ
ทำตามคำแนะนำการสร้างและเลือกตัวเลือก "If Building With Browser Source" ซึ่งรวมถึงขั้นตอนในการดาวน์โหลด/แยก Wrapper CEF และตั้งค่าตัวแปร CMake ที่ต้องการ