Languages

Menu
Sites
Language
How do parametrs sent from javascript to native part?

Hi, everibody! I develope a music app and i need a help!

I need to manipulate of song duration position with javascript and sent a SeekTo  long msTime parameter to the c++ code in a Tizen::Media::Player::SeekTo(long msTime)

I can't sent a "long msTime" to Tizen::Media::Player::SeekTo(long msTime).

I sent a pause command. It's Ok.

if(gRemoteMessagePort) {
sendCommand("pause");
}

I sent a seekTo command to  Tizen::Media::Player::SeekTo(long msTime). it's fail.


if(gRemoteMessagePort) {
sendCommand("seekto", longMsTime);

 

Can you explain me how to sent data parameters to native function or give me a working example of code?

 

Thanks.

 

Responses

2 Replies
Alex Dem

Hi ,
In dev guide message port api for web apps (find RemoteMessagePort):
https://developer.tizen.org/dev-guide/2.2.1/org.tizen.native.apireference/classTizen_1_1Io_1_1RemoteMessagePort.html

There is sendMessage() method is used for RemoteMessagePort with  MessagePortDataItem array, and every MessagePortDataItem  contains pair {     DOMString key;     DOMString value;   };
Looks like you should send message this way :
 remoteMsgPort.sendMessage(
   [
     { key:'seekto', value: 1234 } //value is some value to seek
   ]
   , localMsgPort);
and parse it in Native service in OnMessageReceivedN()
https://developer.tizen.org/dev-guide/2.2.1/org.tizen.native.apireference/classTizen_1_1Io_1_1RemoteMessagePort.html

p.s. You could look at this article also:
https://developer.tizen.org/documentation/articles/accessing-native-audio-playback-and-recorder-controls-web-applications
Alexey.

Alex Dem

please replace first link with this:

https://developer.tizen.org/dev-guide/2.2.1/org.tizen.web.device.apireference/tizen/messageport.html#::MessagePort::RemoteMessagePort