obs-browserobs-browserintroducesacross-platformBrowserSource,poweredbyCEF(ChromiumEmbeddedFramework),toOBSStudio.ABrowserSourceallowstheusertointegrateweb-basedoverlaysintotheirscenes,withcompleteaccesstomodernwebAPIs.OnWindows,thisalsoaddssupportforServiceIntegration(linkingthirdpartyservices)andBrowserDocks(webpagesloadedintotheinterfaceitself).macOSsupportforserviceintegration&browserdocksisintheworks,andLinuxsupportisplanned.ThispluginisincludedbydefaultonofficialpackagesonWindowsandmacOS.WhileLinuxissupported,theofficialppadoesnotcurrentlyincludethebrowsersourceduetoaconflictwithGTK.JSBindingsobs-browserprovidesaglobalobjectthatallowsaccesstosomeOBS-specificfunctionalityfromJavaScript.ThiscanbeusedtocreateanoverlaythatadaptsdynamicallytochangesinOBS.GetBrowserPluginVersion/***@returns{number}OBSBrowserpluginversion*/window.obsstudio.pluginVersion//=>1.24.0Registerforeventcallbacks/***@typedef{Object}OBSEvent*@property{object}detail-datafromevent*/window.addEventListener('obsSceneChanged',function(event){vart=document.createTextNode(event.detail.name)document.body.appendChild(t)})AvailableeventsDescriptionsfortheseeventscanbefoundhere.obsSceneChangedobsSourceVisibleChangedobsSourceActiveChangedobsStreamingStartingobsStreamingStartedobsStreamingStoppingobsStreamingStoppedobsRecordingStartingobsRecordingStartedobsRecordingPausedobsRecordingUnpausedobsRecordingStoppingobsRecordingStoppedobsReplaybufferStartingobsReplaybufferStartedobsReplaybufferSavedobsReplaybufferStoppingobsReplaybufferStoppedobsVirtualcamStartedobsVirtualcamStoppedobsExitControlOBSGetwebpagecontrolpermissionsPermissionsrequired:NONE/***@type{number}level-Thelevelofpermissions.0forNONE,1forREAD_ONLY,2forBASIC,3forADVANCEDand4forALL**@param{function}callback*@returns{Level}*/window.obsstudio.getControlLevel(function(level){console.log(level)})GetthecurrentscenePermissionsrequired:READ_ONLY/***@typedef{Object}Scene*@property{string}name-nameofthescene*@property{number}width-widthofthescene*@property{number}height-heightofthescene*//***@param{function}callback*@returns{Scene}*/window.obsstudio.getCurrentScene(function(scene){console.log(scene)})GetOBSoutputstatusPermissionsrequired:READ_ONLY/***@typedef{Object}Status*@property{boolean}recording-notaffectedbypausestate*@property{boolean}recordingPaused*@property{boolean}streaming*@property{boolean}replaybuffer*@property{boolean}virtualcam*//***@param{function}callback*@returns{Status}*/window.obsstudio.getStatus(function(status){console.log(status)})SavetheReplayBufferPermissionsrequired:BASIC/***Doesnotacceptanyparametersanddoesnotreturnanything*/window.obsstudio.saveReplayBuffer()StarttheReplayBufferPermissionsrequired:ADVANCED/***Doesnotacceptanyparametersanddoesnotreturnanything*/window.obsstudio.startReplayBuffer()StoptheReplayBufferPermissionsrequired:ADVANCED/***Doesnotacceptanyparametersanddoesnotreturnanything*/window.obsstudio.stopReplayBuffer()StartstreamingPermissionsrequired:ALL/***Doesnotacceptanyparametersanddoesnotreturnanything*/window.obsstudio.startStreaming()StopstreamingPermissionsrequired:ALL/***Doesnotacceptanyparametersanddoesnotreturnanything*/window.obsstudio.stopStreaming()StartrecordingPermissionsrequired:ALL/***Doesnotacceptanyparametersanddoesnotreturnanything*/window.obsstudio.startRecording()StoprecordingPermissionsrequired:ALL/***Doesnotacceptanyparametersanddoesnotreturnanything*/window.obsstudio.stopRecording()PauserecordingPermissionsrequired:ALL/***Doesnotacceptanyparametersanddoesnotreturnanything*/window.obsstudio.pauseRecording()UnpauserecordingPermissionsrequired:ALL/***Doesnotacceptanyparametersanddoesnotreturnanything*/window.obsstudio.unpauseRecording()StarttheVirtualCameraPermissionsrequired:ALL/***Doesnotacceptanyparametersanddoesnotreturnanything*/window.obsstudio.startVirtualcam()StoptheVirtualCameraPermissionsrequired:ALL/***Doesnotacceptanyparametersanddoesnotreturnanything*/window.obsstudio.stopVirtualcam()RegisterforvisibilitycallbacksThismethodislegacy.Registeraneventlistenerinstead./***onVisibilityChangegetscallbackswhenthevisibilityofthebrowsersourcechangesinOBS**@deprecated*@seeobsSourceVisibleChanged*@param{boolean}visibility-True->visible,False->hidden*/window.obsstudio.onVisibilityChange=function(visibility){};Registerforactive/inactivecallbacksThismethodislegacy.Registeraneventlistenerinstead./***onActiveChangegetscallbackswhentheactive/inactivestateofthebrowsersourcechangesinOBS**@deprecated*@seeobsSourceActiveChanged*@param{bool}True->active,False->inactive*/window.obsstudio.onActiveChange=function(active){};BuildingOBSBrowsercannotbebuiltstandalone.ItisbuiltaspartofOBSStudio.Byfollowingtheinstructions,thiswillenableBrowserSource&CustomBrowserDocksonallthreeplatforms.BothBUILD_BROWSERandCEF_ROOT_DIRarerequired.OnWindowsFollowthebuildinstructionsandbesuretodownloadtheCEFWrapperandsetCEF_ROOT_DIRinCMaketopointtotheextractedwrapper.OnmacOSUsethemacOSFullBuildScript.Thiswillautomaticallydownload&enableOBSBrowser.OnLinuxFollowthebuildinstructionsandchoosethe"Ifbuildingwithbrowsersource"option.Thisincludesstepstodownload/extracttheCEFWrapper,andsettherequiredCMakevariables.声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态
评论