views:

1268

answers:

4

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?

A: 

Hmmm... that's an interesting proposition, only keep the downloaded file in Flash's memory. I think it's certainly possible, but probably slow and you would be capped at a few hundred megabytes.

EDIT: It's NOT possible because you cannot listen to ports using just Flash, the browser does not have that type of capability.

CookieOfFortune
From what I know, Flash10 already allows to store files on the disk.
snitko
+2  A: 

Hi,

Flash doesn't allow you to listen on a socket for incoming connections. This would make it really difficult to work with existing torrents. Given the security issues around this, I don't see it happening.

Adobe, however, has started their own version of a P2P system called Stratus. You can read about that here http://labs.adobe.com/technologies/stratus/

drudru
+12  A: 

the answer is pretty much no ... well, it's 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 ...

ok, basically RTMFP 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 well) connection to the server ... well i guess, a bit of data is transmitted of course, but not the payload ...

the torrent protocol is very different from this ... so no, this is not an option ... you could build an equivalent protocol on top of RTMFP, reverseengineering the stratus service (or wait till 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 ... and Java can do UDP as well ... so 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, or even better, natively ...

back2dos
Thanks, pretty much complete answer.
snitko
That sounds so much like what ninjavideo do with their ninjavideo helper, except they connect to localhost using divx web player not flash.
Enriquev
A: 

All this information is out of date now.

jj