Plugin project and samples to access UVC devices on Unity Android.
Copyright (c) 2014-2019 saki [email protected]
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
All files in the folder are under this Apache License, Version 2.0.
Files under UVC4UnityAndroid/Assets/UVC4UnityAndroidPlugin/Samples/
may have different license. Please read README.md in those folders well.
- Supports UVC 1.0/1.1 and 1.5 devices (Most of UVC devices are UVC1.1).
- Supports
armeabi-v7a
,arm64-v8a
,x86
andx86_64
architectures. - Supports H.264, MJPEG and YUV and automatically decode video images into Texture of Unity. Please see sample scenes in Samples folder.
You can get H.264 stream from Ricoh THETA S([email protected],30fps, dual fisheye video images) and THETA V([email protected],30fps, equirectangular video images), Logitech C920, C922, C930e etc. - Supports multiple UVC devices at the same time(Although frame rate, number of UVC devices and video size will be limited by bandwidth and power supply of USB.)
- Supports both isochronous and bulk transfer.
- Supports USB2 and USB3(experimental).
- Support changing video size.
- Apk with target API level 28 and more never work well on Android 10 devices because of issues on Android 10 itself. Please see details about this on Issue Tracker of Google and My Blog.
- This project is still in progress and some features are not available now. Ex. Controlling UVC devices is not implemented yet. Ex. controlling contrast, brightness, shutter condition etc. do not work yet.
- You can get video images only from UVC devices, some devices like EasyCap are not UVC device and can't get from them. Internal cameras on Android devices also are not supported.
- Backend libraries support UBS3, but USB3 on Android devices are still unstable and it may not work well. In that case please connect your UVC devices over USB2.
- This plugin can work on only real Android devices, can't work on editor of Unity and on
Unity Remote
- User may need to touch app screen after giving USB permission on some Android devices by limitation os Android OS itself.
- This plugin uses
System.Text.Json
(and related packages) from Microsoft to parse JSON. You can install the package usingNuGet
(You can use NuGetForUnity)
If you need to use other package likeJson.NET
to parse json, you can use it with some modification.
- Create new project / open existing project by Unity.
- Install
System.Text.Json
if you don't yet.- Install 'NuGet'(NuGetForUnity).
- Select
Manage NuGet Packages
fromNuGet
menu. - Search
System.Text.Json
from search box. - Select
System.Text.Json
and install it.
- Import release package of
UVC4UnityAndroid
- Open one of sample scene from
UVC4UnityAndroid/Samples/Scenes
folder. - Build and run apk on your real Android device.
- Connect UVC device(s) with Android Device. Some UVC devices / some Android devices may need powered USB hub between UVC device and Android device.
- The plugin project is for Unity 2018.4.14f1 now and may need modification on other Unity version.
- This plugin setup
AndroidManifest.xml
to be able to keep permanent permission for UVC device(s). If you don't want this behavior, please remove following steps. The user need to give permission everytime they connect UVC device(s).- Export your project as project of Android Studio from
Build Settings
window. - Open the exported project with Android Studio.
- Open
AndroidManifest.xml
under{project root}/src/main
- Add
<activity android:name="com.serenegiant.uvcplugin.UsbPermissionActivity" tools:node="remove"/>
inApplication
section. - Build apk with Android Studio.
- Export your project as project of Android Studio from
- r0.1.0 on 24 Dec. 2019
- First release.