I am hoping to show my local cctv in a native module on my Samsung smart tv which has Tizen.
My class NativePlayer extending PP_Instance creates a class which creates a tcpsocket. I have been copying the NativePlayer and Sockets samples for now.
My problem seems to be if I don't create a thread to start my tcpsocket class then when my pp_instance class receives the data in its completioncallback passed back from the socket class then when should I call read on the socket class again - at the bottom of the pp_instance callback function like the sockets sample? If I do this then the UI becomes unresponsive, presumably because the callback is executed on the main thread.
If I spawn a simplethread to create the connection to my DVR and then pass the received data back to my PP_Instance in the completioncallback and then call read the socket again from within the thread after firing the callback then this is fine until the second time I try to access the completioncallback and the module just crashes. I tried to make the completioncallback a class variable in the PP_Instance so it didn't go out of scope but it didn't help.
My understanding is very limited in nacl module and hopefully somebody can point out what I'm doing wrong.
Thank you.