Requires Unity 2017.1 or higher.
A self-contained package for controlling video streaming in Unity. This is a collection of Unity components (scripts) for implementing video streaming in Unity, also over IP.
Sample scenes included.
The webcam example scene running on an Android smartphone.
What's included:
- Main scripts:
WebcamStream
- control the webcam
- see the example scene
WebcamStream
IPCameraStream
- control a remote (or local) IP camera using MJPEG protocol
- see the example scene
IPCameraStream
IPWebcamStreamer
- start as HTTP server and listen for client connections
- stream video frames using MJPEG protocol
- see the example scene
IPWebcamStreamer
- Scripts for UI control:
WebcamStreamUI
- UI control script for
WebcamStream
- control buttons
- device selection
- see the example scene
WebcamStream
- UI control script for
IPCameraStream
- connection configuration
- control buttons
- UI control script for
IPCameraStream
- see the example scene
IPCameraStream
IPWebcamStreamer
- UI control script for
IPWebcamStreamer
- connection configuration
- control buttons
- button for opening a local browser page connected to a video stream (e.g. for testing)
- see the example scene
IPWebcamStreamer
- UI control script for
- Scripts for UI rendering:
VideoStreamToImage
: rendering of a video streaming to a material of an Image.VideoStreamToRenderer
: rendering of a video streaming to a material of a Renderer (e.g.MeshRenderer
, see the small cube in the example scenes).
- Utility scripts:
WebcamComponent
: wrapper forUnityEngine.WebCamTexture
FrameImageResizer
: resizing an Image Transform to keep video frames aspect.VideoStreamingSettings
: serializable data for a video streaming connection.
Browser window connected to the IPWebcamStreamer
example application.
- Windows Standalone (x86/x64)
- Android
- Universal Windows Platform (all the examples compile and run, but
IPWebcamStreamer
does not work yet, mainly due to the limited .NET support of this platform)
Some example scenes are provided to demonstrate different usages of the components.
To see how these component work, see example scenes in Assets/VidStreamComp/Scenes
.
The first implementation was born within GPVUDK.
Part of IPCameraStream
is inspired by the code posted here.
Part of IPWebcamStreamer
is inspired by the code posted here and here.
Thanks in advance to all the people who contributed and will contribute in any way to this project.
Contributions from you are welcome!
If you find bugs or you have any new idea for improvements and new features you can raise an issue on GitHub (please follow the suggested template, filling the proper sections). To open issues or make pull requests please follow the instructions in CONTRIBUTING.md.
Code released under the MIT License.
To try this project with Unity go to the repository page on GitHub press the button Clone or download and choose Download ZIP. Save and unzip the archive to your hard disk and then you can open it with Unity, selecting the sub-folder UnityProject/VidStreamComp.