Hello community,
I have a webpage which shows MJPG-streamer images from a [Raspberry Pi webcam][1] which I want to display inside Unity using a texture. Here's the "/stream" page html code:
I can't use standard 'get' [WWW.texture][2] with this because a stream of images can't be pointed to with a "/stream/image.jpg". I can only access the stream via a "/stream" or "/?action=stream" URI. I have tried the code below, but no luck:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class GET_Stream : MonoBehaviour {
public string url = "http://192.168.1.2:8080/?action=stream";
IEnumerator Start() {
WWW www = new WWW(url);
yield return www;
RawImage renderer = GetComponent();
renderer.texture = www.texture;
}
void Update () {
Start ();
}
}
Another alternative to WWW I know is HttpWebRequest. It may contain something I could use (***I'm currently researching this***), because when I get the stream grab to work, I'll make it work over SSL (using a similar code to **[this][3]**).
Then I began looking for Unity HTML viewers, but the best one I found was for Unity 3.4 - [Awesomium][4]. I did try to install it on Unity 5.4 64-bit (where I got DllNotFoundException) and 32-bit (where I got EntryPointNotFoundException). (I'm surprised that [App Inventor][5] has a WebViewer, but Unity doesn't). I'm looking for free options. Any suggestions?
Awesomium error on Unity 5 32-bit:
EntryPointNotFoundException: awe_string_create_from_utf16
AwesomiumMono.StringHelper..ctor (System.String val)
AwesomiumMono.WebCore.Start ()
AwesomiumMono.WebCore.Initialize (AwesomiumMono.WebCoreConfig config, Boolean start)
WebTexture.Start () (at Assets/WebTexture.cs:32)
Thank you.
[1]: https://github.com/sunfounder/Sunfounder_Smart_Video_Car_Kit_for_RaspberryPi/tree/master/mjpg-streamer/mjpg-streamer
[2]: http://docs.unity3d.com/ScriptReference/WWW-texture.html
[3]: http://answers.unity3d.com/questions/1226915/post-a-form-over-https.html
[4]: http://labs.awesomium.com/unity3d-integration-tutorial-part-1/
[5]: http://appinventor.mit.edu/explore/
↧