Mobile

Vid Stream Comp

VidStreamComp

Components for video streaming in Unity

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.

image

The webcam example scene running on an Android smartphone.

Features

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
    • 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
  • 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 for UnityEngine.WebCamTexture
    • FrameImageResizer: resizing an Image Transform to keep video frames aspect.
    • VideoStreamingSettings: serializable data for a video streaming connection.

image

Browser window connected to the IPWebcamStreamer example application.

Tested platforms:

  • 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)

Documentation

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.

Acknowledgements:

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.

Contributing

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.

License

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.