Shared object between React Native Application and a WebView - Stack Overflow

Let's say I have an React Native App, and all the core code exists there including an object model

Let's say I have an React Native App, and all the core code exists there including an object model something like:

let MyObject = {
    SimpleText : "Hello",
    MediaObject : MediaStream()
}

I have some React Native UI, and also a WebView (.md)

I would like to display the MediaObject from my core RN code, with my WebView using a simple <video> element. for Example: videoEl.srcObject = MyObject.MediaObject

I see that when you use the webview, the script inside the page has access to something called: ReactNativeWebView and with that I can post messages as strings, but I can't send or receive an object (like MediaStream).

I can do everything else i need with post messages, except this problem with the MediaStream

Any way to accomplish this?

So far in my research I found that:

  1. For a few years now you cannot make an object URL of a MediaStream any more, meaning that I can't create the objectURL in the core code, and "pass" the url as a string. Then do something like set the .src = "<object_url>".

  2. Since React Native are able to "expose" a class/object or something to window.XXXXX, am I able to do the same thing? It would be perfect if I could simply say window.MyObject and have access to my object inside the host ReactNative App.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744349482a4569887.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信