Flash10 + p2p真的有用吗? [英] Does Flash10 + p2p really work?

查看:138
本文介绍了Flash10 + p2p真的有用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在搜索,我仍然无法得到它。有人说:你去吧,就用吧。其他人声称,它有一定的限制,不允许您在Flash中使用p2p。



所以,这里有一个简单的问题:是否可能要实现一个Flash10应用程序,它使用一些现有的torrent文件将视频/音频流式传输到用户的浏览器中?

如果不是 - 为什么?有没有可能的解决办法这个不?
如果是 - 执行有什么困难,为什么没有人真的做到了?答案是非常不...呃,说实话,只是没有。
@drudru指出了正确的技术为闪存p2p,即层云。

Flash p2p基于RTMFP,基于UDP构建。实际上,flash绑定了一个端口,但是这个来自内部。



RTMFP基本上允许两件事情:


  1. 视频和音频的UDP流(不可靠,但速度很快)。从闪光灯一侧,您只能发布您的相机和麦克风流。从服务器,几乎所有的东西。

  2. 远程调用到p2p连接的另一个端点。这可以用来传输数据。这种通信是安全的,即包装顺序和完整性由Flash播放器维护。

p2p基于NAT穿透。 Stratus本身就是介绍服务器。此外,出于安全的目的,一个P2P连接还意味着,两个客户端必须有一个空闲的TCP(如果我没记错的话)连接到服务器。我想,当然有一点数据传输,但不是有效载荷。然而,torrent协议与此有很大不同。因此,这不是一个选项。您可以在RTMFP之上构建一个等效的协议,反向工程stratus服务(或者等到它开源)。这当然也可以被非Flash客户端使用。但是,再一次,你将无法将传输的数据视为一个视频,因为你将得到的是一个调用你的 NetStream 的客户端的参数,可能是的ByteArray 。而且你不能播放 ByteArray s。您可以编写非Flash客户端,将视频作为流发布,但是这与我们想要的完全不同。我想。



如果您真的想要做像那你需要Java。您可以签署Java小程序,并且如果用户接受证书,他们几乎不受限制地访问,例如,你可以绑定端口。由于Java可以做UDP,所以你可以有一个Java小程序,它可以做洪流(也许只是使用Vuze代码库),如果你真的想在Flash中显示它(这又需要FLV),那么你可以模仿一个本地的 Flash Media Server并在localhost:someport上发布视频。但是,真的,闪光点对我来说似乎是非常复杂和无用的。而不是尝试用Java来回放,希望这个选项可以在本地执行。


I've been googling around and I still can't get it. Some people say: here you go, just use it. Others claim it has certain restrictions that does not allow you to use p2p the way you want it in Flash.

So, here's a simple question: is it possible to implement a Flash10 application, that uses some of the existing torrent files to stream video/audio right into the user's browser?

If no - why? Is there any possible workaround for this 'no'? If yes - what are the difficulties of the implementation and why have no one actually done it yet?

解决方案

The answer is pretty much no ... well, it's just no, to be honest.
@drudru pointed out the right technology for flash p2p, i.e. stratus.

Flash p2p is based on RTMFP, which is built upon UDP. Actually, flash does bind a port, but this comes from the internals. There is no API to do that manually.

RTMFP basically allows two things:

  1. UDP streaming (unreliable, but fast) for video and audio. From flash side you can only publish your camera and microphone stream. From the server, almost anything.
  2. Doing remote calls to the other endpoint of the p2p connection. This can be used to transfer data. This communication is secured, i.e. package order and integrity is maintained by the flash player.

The p2p is based on NAT punchthroughs. Stratus itself is the introduction server. Also, for security purpose, a p2p connection also means, both clients have to have an idling TCP (if I remember correctly) connection to the server. I guess, a bit of data is transmitted of course, but not the payload.

However, the torrent protocol is very different from this. Therefore, this is not an option. You could build an equivalent protocol on top of RTMFP, reverseengineering the stratus service (or wait until it's open sourced). This could of course also be used by non-flash clients. But again, you would not be able to watch the transmitted data as a video, since you will get is as a param to some call to the client of your NetStream, probably a ByteArray. And you cannot play back ByteArrays. You could write non flash clients, that publish videos as a stream, but that would be far from what you wanted, I guess.

If you really want to do anything like that, you need Java. You can sign Java applets, and if user accepts the certificate, they have practically unrestricted access, e.g. you could bind ports. Since Java can do UDP, you could have a Java applet, that does the torrenting (maybe just use the Vuze codebase) and if you really want to display it in flash (which in turn requires flv), then you could mime a local "Flash Media Server" and publish the video on localhost:someport. But really, the flash bit seems ridiculously complicated and useless to me. Rather try playing back with Java, which hopefully has an option to do so natively.

这篇关于Flash10 + p2p真的有用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆