JJin
JJin

Reputation: 327

Google Native Client, sending binary data from NACL to the frontend

How do I send binary data, e.g. mp3/mp4 data back to the frontend ?

I know there are two ways of doing it: utilizing the sandbox filesystem provided by NACL and get the url at the frontend; passing the data through the PostMessage() using VarArrayBuffer. It would be great if someone could give me a simple example of how to pass the binary data through PostMessage(). There is a Pong example for NACl FileSystem API but I 'm kind of confused on how to retrieve the file location as url so that the frontend JS could get it through the message.

Here is what I have done so far, using the second method of passing data through PostMessage() and VarArrayBuffer:

So, how should the JS side catch the array buffer? Is it through message.data or something else?

Upvotes: 13

Views: 1488

Answers (0)

Related Questions