Google's own client sending binary data from the NACL to the web interface

How to send binary data, for example, mp3/mp4 back to the external interface?

I know that there are two ways to do this: use the sandbox file system provided by NACL and get the URL in the frontend; Passing data through PostMessage() using a VarArrayBuffer . It would be great if someone could give me a simple example of how to pass binary data through PostMessage() . There is a Pong example for the NACl FileSystem API, but I'm a little confused how to get the file location as a URL so that the JS interface can receive it via a message.

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

  • I successfully extracted the data from the mp4 online file and saved it in the vector vector<char> outputBuffer .

  • Flushes data to a new character buffer and creates a VarArrayBuffer to store data and pass it to the JS side

     char* binaryBuffer = new char[outputBuffer.size()]; int increment = 0; for (vector<char>::iterator it = outputBuffer.begin(); it != outputBuffer.end(); it++) { binaryBuffer[increment] = *it; } pp::VarArrayBuffer outBuffer(binaryBuffer); instance_->PostMessage(outBuffer);//instance_ is a NACL module instance 

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

+8
c ++ javascript arrays bytearray google-nativeclient
source share

No one has answered this question yet.

See similar questions:

2
How to get the sum of values ​​in an array in Google Native Client inside C ++?

or similar:

635
How to pass variables and data from PHP to JavaScript?
2
Send binary data from a third server to its own client module
2
Install chrome native client (nacl)
one
PHP for native client (NaCl)
0
Expected acceleration of using Google Native Client (NACL) for input-output in javascript application?
0
How to implement a callback after sending a NaCl message (Chrome native client)?
0
How to use a library ported for my own client (NaCl)?
0
Trying to install nacl (native client) from google but getting syntax error
0
Why slow demos on the native client (nacl)?

All Articles