/// <summary>
        /// Set settings of the specified BrowserSource
        /// </summary>
        /// <param name="sourceName">Source name</param>
        /// <param name="props">BrowserSource properties</param>
        /// <param name="sceneName">Optional name of a scene where the specified source can be found</param>
        public void SetBrowserSourceProperties(string sourceName, BrowserSourceProperties props, string sceneName = null)
        {
            //override sourcename in props with the name passed
            props.Source = sourceName;
            var request    = new JObject();
            var jsonString = JsonConvert.SerializeObject(request);

            JsonConvert.PopulateObject(jsonString, request);
            FireRequest("SetBrowserSourceProperties", request);
        }
示例#2
0
        public void SetWebBrowserSource(string source, string url)
        {
            try
            {
                this.OBSWebsocket.SetSourceRender(source, false);

                BrowserSourceProperties properties = this.OBSWebsocket.GetBrowserSourceProperties(source);
                properties.IsLocalFile = false;
                properties.URL         = url;
                this.OBSWebsocket.SetBrowserSourceProperties(source, properties);
            }
            catch (Exception ex) { Logger.Log(ex); }
        }
        public Task SetWebBrowserSourceURL(string sourceName, string url)
        {
            try
            {
                this.SetSourceVisibility(sourceName, visibility: false);

                BrowserSourceProperties properties = this.OBSWebsocket.GetBrowserSourceProperties(sourceName);
                properties.IsLocalFile = false;
                properties.URL         = url;
                this.OBSWebsocket.SetBrowserSourceProperties(sourceName, properties);
            }
            catch (Exception ex) { Logger.Log(ex); }
            return(Task.FromResult(0));
        }
示例#4
0
        public async Task SetWebBrowserSourceURL(string sceneName, string sourceName, string url)
        {
            Logger.Log(LogLevel.Debug, "Setting web browser URL - " + sourceName);

            await this.SetSourceVisibility(sceneName, sourceName, visibility : false);

            await this.OBSCommandTimeoutWrapper((cancellationToken) =>
            {
                BrowserSourceProperties properties = this.OBSWebsocket.GetBrowserSourceProperties(sourceName, sceneName);
                properties.IsLocalFile             = false;
                properties.URL = url;
                this.OBSWebsocket.SetBrowserSourceProperties(sourceName, properties);

                return(true);
            });
        }