我的目标是创建一个有趣的应用程序,它将播放来自youtube的chrome嵌入式组件的音频,而视频将从本系列电影的另一部分的TWebBrowser组件中显示(仅用于开玩笑)...
问题是,我无法在Delphi中将TWebBrowser静音,但它在真正的Internet Explorer中工作...它足以改变 HKEY_CURRENT_USER \ Software \ Microsoft \ Internet Explorer \ Main \ Play_Background_Sounds为“no”,IE中的Youtube将无法播放音频(YT上也没有音量控制图标):
我尝试在Delphi中执行此操作:
var rg:TRegistry ;
....
rg :=TRegistry.Create;
rg.RootKey :=HKEY_CURRENT_USER;
rg.OpenKey('\software\microsoft\internet explorer\main\',true);
rg.WriteString('Display Inline Images','no'); // for faster download - btw this one worked in TWebBrowser
rg.WriteString('Play_Background_Sounds','no'); // Not working in TWebBrowser , neither in TembeddedWB
没有工作......
还试过这个(标记导航):
const
DLCTL_DLIMAGES = $00000010;
DLCTL_VIDEOS = $00000020;
DLCTL_BGSOUNDS = $00000040;
DLCTL_NO_SCRIPTS = $00000080;
DLCTL_NO_JAVA = $00000100;
DLCTL_NO_RUNACTIVEXCTLS = $00000200;
DLCTL_NO_DLACTIVEXCTLS = $00000400;
DLCTL_DOWNLOADONLY = $00000800;
DLCTL_NO_FRAMEDOWNLOAD = $00001000;
DLCTL_RESYNCHRONIZE = $00002000;
DLCTL_PRAGMA_NO_CACHE = $00004000;
DLCTL_FORCEOFFLINE = $10000000;
DLCTL_NO_CLIENTPULL = $20000000;
DLCTL_SILENT = $40000000;
DLCTL_OFFLINEIFNOTCONNECTED = $80000000;
然后
var
WebPage: Integer;
flags: OleVariant;
WebPage := 'https://youtube.com/ ...';
Flags := DLCTL_BGSOUNDS +
DLCTL_PRAGMA_NO_CACHE +
0 ;
iexplorer1.navigate(webpage,flags);
再没有成功......
我做错了什么? 我们将不胜感激。
PS:抱歉我的英文