【发布时间】:2022-07-07 23:27:03
【问题描述】:
我尝试入站 fmx.TWebbrowser (Delphi 11) 以在 iphone 应用程序中显示 youtube 流。 如果我单击流图片,流将在 iphone 电影播放器窗口中打开。所以我必须缩小,才能在应用程序中查看视频。在 Android 设备上它工作正常。另外,当我在 Xcode 中编写应用程序时,我可以设置“内联播放”,并且流在 wkwebview 中内联工作。
在 Delphi/RAD 中,我可以修改 FMX.Webbrowser.Cocoa。可以使用函数 configuration.setAllowsInlineMediaPlayback(true)。如果我之后检查这个,configuration.allowsinlineMediaPlayback 仍然是假的。
例子:
constructor TCommonWebBrowserService.Create;
var test:Boolean;
begin
FWebView := TNativeWebViewHelper.CreateAndInitWebView;
FWebView.configuration.setAllowsInlineMediaPlayback(True);
test:=FWebView.configuration.AllowsInlineMediaPlayback;
测试仍然是假的。
Apple 写道:setAllowsInlineMediaPlayback 必须在创建时设置。
在 FMX.Webbrowser.Delegate.IOS 有
class function TNativeWebViewHelper.CreateAndInitWebView: WKWebView;
begin
Result := TWKWebView.Create();
end;
但是没有办法设置.configuration.setAllowsInlineMediaPlayback(True);
在 FMX.Webbrowser.delegate.ios 有一个函数叫做
function TWebViewDelegate.webViewCreateWebViewWithConfigura tion(webView: WKWebView; configuration: WKWebViewConfiguration;navigationAction: WKNavigationAction; windowFeatures: WKWindowFeatures): WKWebView;
但是Delphi不使用这个功能。
这个问题有替代或解决方案吗?
非常感谢。
【问题讨论】:
标签: ios delphi youtube twebbrowser