简体   繁体   English

使用NPAPI界面加载flash .swf

[英]Loading flash .swf using NPAPI interface

I tried to write a program with load a SWF file directly, and I am going to use NPAPI to implement that program. 我试图编写一个直接加载SWF文件的程序,而我将使用NPAPI来实现该程序。

But, I don't know how to start it. 但是,我不知道如何启动它。 I mean how to communication between cocoa and NPAPI? 我的意思是可可和NPAPI之间如何通信? And how to build the architecture of program? 以及如何构建程序架构?

I searched Google in many times, there is no many useful information for this topic. 我搜索过Google多次,没有关于此主题的有用信息。

I hope anyone can help me. 我希望有人能帮助我。

Any suggestion will be appreciated. 任何建议将不胜感激。

Building an NPAPI host is non-trivial; 构建NPAPI主机并非易事。 if you really want to do it yourself from scratch your best bet would be to look at the source for Gecko, WebKit, and/or Chromium, and re-use whatever you can from there (assuming your app's source license makes that possible). 如果您真的想自己动手做,最好的选择是查看Gecko,WebKit和/或Chromium的源代码,然后重用那里的任何内容(假设您应用程序的源代码许可证使之成为可能)。

Other than that, Mozilla's NPAPI documentation is the best source, along with the list of accepted NPAPI extensions for more recent changes (since you mentioned the Mac, you'll need to read and understand at least the Cocoa, Core Graphics, Core Animation, and negotiation proposals). 除此之外, Mozilla的NPAPI文档以及最近更新中可接受的NPAPI扩展列表都是最好的资料(自从您提到Mac以来,您至少需要阅读和理解可可,核心图形,核心动画,和谈判建议)。 Just keep in mind that a lot of how NPAPI works is de-facto standard based on what other browsers do, so just the documentation won't be enough. 只需记住,NPAPI的许多工作方式都是基于其他浏览器的实际标准,因此仅提供文档是不够的。

You mentioned in a comment that you don't want to use WebKit because of a "security issue"—if you know of a security issue in WebKit, why not fix it instead of building a really complicated system from scratch? 您在评论中提到,由于“安全问题”,您不想使用WebKit。如果您知道WebKit中的安全问题,为什么不解决它而不是从头开始构建一个非常复杂的系统? It's very, very unlikely that if you make a from-scratch implementation of an NPAPI host you will end up making fewer security mistakes than exist in a mature implementation that's been tested, debugged, and improved over the course of a number of years. 这是非常, 非常不可能,如果你犯了一个从划痕实施的NPAPI的主机,你最终会比在一直测试,调试,并在数年的过程中提高了一个成熟的实现存在使得更少的安全错误的。

Particularly given the amount of plugin background you seem to have so far, I would strongly recommend that you use FireBreath . 特别是考虑到您到目前为止所拥有的插件背景数量,我强烈建议您使用FireBreath It will at least get you through the plugin part. 至少会帮助您完成插件部分。 The rest is up to you, and it won't be simple. 其余的取决于您,这将不会很简单。

One thing to know is that different browsers on Mac OS X use different drawing models and different event models. 要知道的一件事是,Mac OS X上的不同浏览器使用不同的绘图模型和不同的事件模型。 For event models, the general rule of thumb is that 32 bit browsers support Carbon and 64 bit support Cocoa, though some 32 bit browser support Cocoa. 对于事件模型,一般的经验法则是32位浏览器支持Carbon和64位支持Cocoa,尽管有些32位浏览器支持Cocoa。 Depending on 32/64 bit and the browser (and version) you may need to draw with QuickDraw, Cocoa, CoreAnimation, or CoreGraphics. 根据32/64位和浏览器(和版本)的不同,您可能需要使用QuickDraw,Cocoa,CoreAnimation或CoreGraphics进行绘制。

There is more information about this on the FireBreath wiki (main website). 在FireBreath Wiki(主网站)上有关于此的更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM