4

我将 youtube 视频嵌入到 node-webkit无框架应用程序中,每当单击视频中的 youtube 链接时,预期的行为是在默认浏览器中打开 url,但它所做的是创建一个新的 node-webkit无框架我的应用程序顶部的窗口。iv'e 尝试覆盖 window.open 但这无济于事,因为 flash 可能使用其他一些 api 来启动新窗口,我正在寻找一种完全禁用新窗口或能够随时拦截的方法打开一个新窗口并将 url 重定向到默认浏览器。我查看了api,似乎javascript没有暴露给具有所有窗口实例的浏览器进程。

关于如何解决这个问题的任何想法?

编辑:好的,所以有一种方法可以禁用闪存调用navigateToURL它是您添加到您的参数:<param name="allowNetworking" value="internal"/>虽然不理想,但这有助于用户体验。来源: http://livedocs.adobe.com/flex/3/html/help.html?content= wrapper_13.html

第二次编辑:我发现的另一个错误是第二个弹出窗口完全崩溃了 node-webkit,这是控制台没有输出任何有用的内容:

2013-11-07 22:42:52.435 node-webkit[78145:507] Internals of CFAllocator not known; out-of-memory failures via CFAllocator will not result in termination. http://crbug.com/45650
2013-11-07 22:42:52.609 node-webkit Helper[78146:507] Internals of CFAllocator not known; out-of-memory failures via CFAllocator will not result in termination. http://crbug.com/45650
2013-11-07 22:42:52.803 node-webkit Helper EH[78147:507] Internals of CFAllocator not known; out-of-memory failures via CFAllocator will not result in termination. http://crbug.com/45650
2013-11-07 22:42:52.932 node-webkit Helper EH[78148:507] Internals of CFAllocator not known; out-of-memory failures via CFAllocator will not result in termination. http://crbug.com/45650
[78148:1107/224252:INFO:plugin_main_mac.mm(22)] No Carbon Interpose library found.
2013-11-07 22:42:53.103 node-webkit Helper[78149:507] Internals of CFAllocator not known; out-of-memory failures via CFAllocator will not result in termination. http://crbug.com/45650
[78145:1107/224253:INFO:simple_index_file.cc(397)] Simple Cache Index is being restored from disk.
2013-11-07 22:42:53.653 node-webkit Helper[78151:507] Internals of CFAllocator not known; out-of-memory failures via CFAllocator will not result in termination. http://crbug.com/45650
2013-11-07 22:42:54.036 node-webkit Helper EH[78148:507] CoreText performance note: Client called CTFontCreateWithName() using name "Arial Unicode MS" and got font with PostScript name "ArialUnicodeMS". For best performance, only use PostScript names when calling this API.
2013-11-07 22:42:54.036 node-webkit Helper EH[78148:507] CoreText performance note: Set a breakpoint on CTFontLogSuboptimalRequest to debug.
2013-11-07 22:42:54.519 node-webkit Helper EH[78148:507] CoreText performance note: Client called CTFontCreateWithName() using name "Times Roman" and got font with PostScript name "Times-Roman". For best performance, only use PostScript names when calling this API.
[78145:1107/224258:INFO:CONSOLE(0)] "'KeyboardEvent.keyLocation'' is deprecated. Please use 'KeyboardEvent.location' instead.", source:  (0)
4

2 回答 2

1

我尝试了很多变体,包括 YouTube 的推荐 iFrame 嵌入方法,但根据https://developers.google.com/youtube/player_parameters上的文档,您无法完全摆脱 YouTube 链接。

您可以做的最好的事情是隐藏大部分控件等,但在播放过程中,用户仍然可以选择单击 YouTube 徽标并离开您的网站。

于 2013-11-08T13:00:34.143 回答
1

如果您在 node-webkit 应用程序中使用WebChimera,您可以使用它播放 youtube 链接并将您想要的按钮添加到工具栏(几乎不需要编程),然后将按钮单击事件发送给 JS 以告诉它要做什么。(在您的情况下,使用默认浏览器打开 youtube 链接)

WebChimera Player 移植到 Node-Webkit(应用程序中嵌入了 WebChimera 插件): https ://github.com/jaruba/WebChimeraPlayerNW

适用于 Windows 的下载链接

对于 Mac,Readme.md 中有分步说明。

于 2015-04-03T20:11:22.210 回答