Is posible change the webgadget audio volume?
Or turn mute or any thing like this?
Thanks!!
webGadget audio question
webGadget audio question
If translation=Error: reply="Sorry, Im Spanish": Endif
- VB6_to_PBx
- Enthusiast
- Posts: 625
- Joined: Mon May 09, 2011 9:36 am
Re: webGadget audio question
this Code can change Volume and Muteminimy wrote:Is posible change the webgadget audio volume?
Or turn mute or any thing like this?
Thanks!!
Code: Select all
;===== Registry: temp setting to optimise web gadget =====
Global sglpValueName.s = GetFilePart(ProgramFilename())
Global lglpData.l = 11001
Global lglpdwDisposition.l
Global igphkResult.i
If RegCreateKeyEx_(#HKEY_CURRENT_USER, "SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", 0, #Null, #REG_OPTION_VOLATILE, #KEY_ALL_ACCESS, #Null, @igphkResult, @lglpdwDisposition) = #ERROR_SUCCESS
RegSetValueEx_(igphkResult, sglpValueName, 0, #REG_DWORD, @lglpData, SizeOf(LONG))
RegCloseKey_(igphkResult)
EndIf
Global.s HTML, Filename
Declare Player()
OpenWindow(0, 0, 0, 1200, 940, "WebGadget", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
CreateMenu(1, WindowID(0))
MenuTitle("Files")
MenuItem(0," Open File ")
WebGadget(5, 0, 0, 1200, 940, "about:blank")
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Menu
Filename = OpenFileRequester("Choose a mp4", "", "MP4|*.mp4;*.flv;*.mp3", 0) ;Pattern$ = "Videos |*.flv;*.mp4"
SetWindowTitle(0,Filename)
Player()
SetGadgetItemText(5, #PB_Web_HtmlCode, HTML)
Case #PB_Event_SizeWindow
ResizeGadget(5, 0, 0,WindowWidth(0)-20, WindowHeight(0)-20)
EndSelect
Until Event = #PB_Event_CloseWindow
; Declare Player()
Procedure Player()
HTML = "<html>" +
"<body>" +
"<button onclick='playPause()'>Play / Pause</button>" +
"<button onclick='setMuteVolume()' type='button'>Mute volume</button>" +
"<button onclick='setQuarterVolume()' type='button'>Set volume to 25 %</button>" +
"<button onclick='setHalfVolume()' type='button'>Set volume to 50 %</button>" +
"<button onclick='setFullVolume()' type='button'>Set volume to 100 %</button><br>" +
"<button onclick='VidSize640x480()' type='button'>Video Size 640x480</button>" +
"<button onclick='VidSize940x705()' type='button'>Video Size 940x705</button>" +
"<button onclick='VidSize1160x870()' type='button'>Video Size 1160x870</button><br>" +
"<video id='myVideo' controls>" +
"<source src='"+Filename+"'></video>" +
"<script>" +
"var vid = document.getElementById('myVideo');" +
"vid.volume = 1;" +
"vid.width = 1160;" +
"vid.height = 870;" +
"var playPause = function() {" +
"if (vid.paused)" +
" vid.play();" +
"else" +
" vid.pause();" +
"};" +
"var getVolume = function() {" +
"alert(vid.volume);" +
"};" +
"var setMuteVolume = function() {" +
"vid.volume = 0;" +
"};" +
"var setQuarterVolume = function() {" +
"vid.volume = 0.25;" +
"};" +
"var setHalfVolume = function() {" +
"vid.volume = 0.5;" +
"};" +
"var setFullVolume = function() {" +
"vid.volume = 1;" +
"};" +
"var VidSize640x480 = function() {" +
"vid.width = 640;" +
"vid.height = 480;" +
"};" +
"var VidSize940x705 = function() {" +
"vid.width = 940;" +
"vid.height = 705;" +
"};" +
"var VidSize1160x870 = function() {" +
"vid.width = 1160;" +
"vid.height = 870;" +
"};" +
"</script>" +
"</html>"
EndProcedure
PureBasic .... making tiny electrons do what you want !
"With every mistake we must surely be learning" - George Harrison
Re: webGadget audio question
Hey VB6_to_PBx thank you very much!!
I see, you use HTML5 video and a bit of js to control the options.
Very clever!!
Do you know any way to execute js functions into webgadget from PB?
Is this possible?
Thanks again!!
I see, you use HTML5 video and a bit of js to control the options.
Very clever!!
Do you know any way to execute js functions into webgadget from PB?
Is this possible?
Thanks again!!
If translation=Error: reply="Sorry, Im Spanish": Endif
- VB6_to_PBx
- Enthusiast
- Posts: 625
- Joined: Mon May 09, 2011 9:36 am
Re: webGadget audio question
minimy wrote:Hey VB6_to_PBx thank you very much!!
I see, you use HTML5 video and a bit of js to control the options.
Very clever!!
Do you know any way to execute js functions into webgadget from PB?
Is this possible?
Thanks again!!
i'm just a Beginner in HTML5 and this was my first effort using HTML5 How To's from here :
https://www.w3schools.com/html/html5_video.asp
i'm actually using most of this PB Code to display .MP4 Help videos bundled with my Softwares
i recommend replacing this Code line :
Code: Select all
Filename = OpenFileRequester("Choose a mp4", "", "MP4|*.mp4;*.flv;*.mp3", 0) ;Pattern$ = "Videos |*.flv;*.mp4"
Code: Select all
Filename = OpenFileRequester("Choose a mp4", "", "MP4|*.mp4", 0)
.MP4 files always seem to work ... could be my FireFox version + Win10 Computer ?? , i haven't tested in Window's Edge Browser
maybe some PureBasic Experts can help you out more ,
and look into SpiderBasic
PureBasic .... making tiny electrons do what you want !
"With every mistake we must surely be learning" - George Harrison
Re: webGadget audio question
Hi VB6_to_PBx, yes. The good formats for web are mp4,webm and ogv.
Nice job!
I will be noob for ever, after lot of years programming.. lol.
Thanks and happy christmas friend!
Nice job!
I will be noob for ever, after lot of years programming.. lol.
Thanks and happy christmas friend!
If translation=Error: reply="Sorry, Im Spanish": Endif
- VB6_to_PBx
- Enthusiast
- Posts: 625
- Joined: Mon May 09, 2011 9:36 am
Re: webGadget audio question
glad it helped you ,minimy wrote:Hi VB6_to_PBx, yes. The good formats for web are mp4,webm and ogv.
Nice job!
I will be noob for ever, after lot of years programming.. lol.
Thanks and happy christmas friend!
and have a Merry Christmas to you and yours !
PureBasic .... making tiny electrons do what you want !
"With every mistake we must surely be learning" - George Harrison
Re: webGadget audio question
Hey VB2PB sorry i no see your post.
Many, many thanks friend! Be happy and be safe!
Many, many thanks friend! Be happy and be safe!
If translation=Error: reply="Sorry, Im Spanish": Endif