SetBrowserVolume: Difference between revisions
Jump to navigation
Jump to search
m (fix oop variable) |
(Wrong example) |
||
Line 23: | Line 23: | ||
--Let's create a new browser in remote mode. | --Let's create a new browser in remote mode. | ||
local | local webBrowser = createBrowser(screenWidth, screenHeight, false, false) | ||
-- The event onClientBrowserCreated will be triggered, after the browser has been initialized. | --Function to render the browser. | ||
-- After this event has been triggered, we will be able to load our URL | function webBrowserRender() | ||
--Render the browser on the full size of the screen. | |||
addEventHandler("onClientBrowserCreated", | dxDrawImage(0, 0, screenWidth, screenHeight, webBrowser, 0, 0, 0, tocolor(255,255,255,255), true) | ||
end | |||
--The event onClientBrowserCreated will be triggered, after the browser has been initialized. | |||
--After this event has been triggered, we will be able to load our URL and start drawing. | |||
addEventHandler("onClientBrowserCreated", webBrowser, | |||
function() | function() | ||
-- After the browser has been initialized, we can load www.youtube.com | --After the browser has been initialized, we can load www.youtube.com | ||
loadBrowserURL( | loadBrowserURL(webBrowser, "http://www.youtube.com") | ||
--Now we can start to render the browser. | |||
addEventHandler("onClientRender", root, webBrowserRender) | |||
end | end | ||
) | ) | ||
addCommandHandler ("volume", -- Add command named 'volume' | |||
addCommandHandler ("volume", -- Add command named ' | function (command, value) | ||
function ( | |||
if tonumber (value) then -- checking if the value is a number | if tonumber (value) then -- checking if the value is a number | ||
setBrowserVolume (theBrowser, value) -- setting the volume value | setBrowserVolume (theBrowser, value) -- setting the volume value | ||
else -- if there is no value | else -- if there is no value | ||
outputChatBox ("You must enter a value." | outputChatBox ("You must enter a value.") | ||
end | end | ||
end | end |
Revision as of 02:09, 9 September 2016
This function sets either a specific browser's volume, or the overall volume for browsers.
Syntax
bool setBrowserVolume ( [browser webBrowser], float volume )
OOP Syntax Help! I don't understand this!
- Method: browser:setVolume(...)
- Variable: .volume
- Counterpart: getBrowserVolume
Required Arguments
- volume: A floating point number representing the desired volume level. Range is from 0.0 to 1.0
Optional Arguments
- webBrowser: A browser element
Example
--In order to render the browser on the full screen, we need to know the dimensions. local screenWidth, screenHeight = guiGetScreenSize() --Let's create a new browser in remote mode. local webBrowser = createBrowser(screenWidth, screenHeight, false, false) --Function to render the browser. function webBrowserRender() --Render the browser on the full size of the screen. dxDrawImage(0, 0, screenWidth, screenHeight, webBrowser, 0, 0, 0, tocolor(255,255,255,255), true) end --The event onClientBrowserCreated will be triggered, after the browser has been initialized. --After this event has been triggered, we will be able to load our URL and start drawing. addEventHandler("onClientBrowserCreated", webBrowser, function() --After the browser has been initialized, we can load www.youtube.com loadBrowserURL(webBrowser, "http://www.youtube.com") --Now we can start to render the browser. addEventHandler("onClientRender", root, webBrowserRender) end ) addCommandHandler ("volume", -- Add command named 'volume' function (command, value) if tonumber (value) then -- checking if the value is a number setBrowserVolume (theBrowser, value) -- setting the volume value else -- if there is no value outputChatBox ("You must enter a value.") end end )
See Also
- canBrowserNavigateBack
- canBrowserNavigateForward
- createBrowser
- executeBrowserJavascript
- focusBrowser
- getBrowserProperty
- getBrowserSettings
- getBrowserSource
- getBrowserTitle
- getBrowserURL
- injectBrowserMouseDown
- injectBrowserMouseMove
- injectBrowserMouseUp
- injectBrowserMouseWheel
- isBrowserDomainBlocked
- isBrowserFocused
- isBrowserLoading
- isBrowserRenderingPaused
- loadBrowserURL
- navigateBrowserBack
- navigateBrowserForward
- reloadBrowserPage
- requestBrowserDomains
- resizeBrowser
- setBrowserAjaxHandler
- setBrowserProperty
- setBrowserRenderingPaused
- setBrowserVolume
- toggleBrowserDevTools