我用 Swift 最新版本和 xcode 8.3.3 制作了一个简单的浏览器。当有 html5 视频(如在 youtube 上)时,我希望能够全屏输入。我现在在 youtube 上看到“全屏不可用”。旧的 WebView 有同样的问题......在 iOS 上它可以工作。
编辑。也许只是不可能。我尝试查看 JavaFX WebView 和 WPF WebBrowser,它们有相同的限制。实际上,有人能够在 WPF WebBrowser 上允许全屏播放 youtube 视频,但只能通过创建完整的 html 页面: 在 WebBrowser 控件中全屏播放 youtube
当然我不能为页面中的每个视频创建一个网页(至少我不知道如何,如果你知道请告诉我)。
原始信息:我使用 Swift 最新版本和 xcode 8.3.3 制作了一个简单的浏览器。一切正常,但我无法像使用旧的 WebView 那样激活插件。因为我使用的是 mac,所以我应该能够激活插件(我知道在 iOS 上是不可能的)我错了吗?
另外(在这里我在旧的 WebView 中遇到了同样的问题)没有办法为 html5 视频激活全屏(至少我不知道如何)。
@IBOutlet weak var webView: WKWebView!
let urlString = "http://myurl.com/"
self.webView.load(NSURLRequest(url: NSURL(string: urlString)! as URL) as URLRequest!)
self.webView.configuration.preferences.plugInsEnabled = true
Run Code Online (Sandbox Code Playgroud)
这是使基本浏览器工作的真正基本代码。但是没有选项可以在 WKWebView 的 Interface Builder 中启用插件,我真的不知道如何允许全屏显示 html5 视频(如 youtube)。
编辑。好的,我终于找到了插件部分的答案:self.webView.configuration.preferences.plugInsEnabled = …
这是我第一次制作Windows Universal应用程序,但无法在UWP应用程序中创建所有内容(例如,无法启动命令行进程)。由于这是一个个人应用程序(我不想将其放在商店中),因此我使用windows.fullTrustProcess启动了WPF win32应用程序,以使我无法在主应用程序中执行任何操作。我还被迫使用UWP,因为我需要一个能够播放全屏html5视频的WebView。
当我尝试在Visual Studio 2017中使用我的应用程序时,一切正常,但是当我尝试制作一个软件包时,出现此错误:
“清单验证错误:第28行,第64列,原因:为元素” [local-name()='Applications'] / [local-name()='Application' 声明的文件名“ Backend-Mini-Browser.exe” 包中不存在'] / [local-name()='Extensions'] / [local-name()='Extension'和@ Category ='windows.fullTrustProcess']“。
但是我的“ Backend-Mini-Browser.exe”位于“ .. \ bin \ x64 \ Debug \ AppX”文件夹中,并且一切都在Visual Studio 2017中运行。
这是我的appxmanifest:
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10" IgnorableNamespaces="uap mp desktop rescap">
<Identity Name="2579cda2-1e8c-48ee-829a-b1d276066cfe" Publisher="CN=Certimeter" Version="1.0.3.0" />
<mp:PhoneIdentity PhoneProductId="2579cda2-1e8c-48ee-829a-b1d276066cfe" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>Mini-browser</DisplayName>
<PublisherDisplayName>Certimeter</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="Mini_browser.App">
<uap:VisualElements DisplayName="Mini-browser" Square150x150Logo="Assets\Square150x150Logo.png" …Run Code Online (Sandbox Code Playgroud)