Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Flash10 + p2p really work?

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?

like image 654
snitko Avatar asked Jul 10 '09 17:07

snitko


1 Answers

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.

like image 51
back2dos Avatar answered Sep 22 '22 01:09

back2dos