Skip to content

rsupport-mobile1-research/unity-view

Repository files navigation

Rsupport app

Setup flutter app to display video call on Unity view

Clone source code

ℹ️ WebRTC

Clone main source code at Main repo

git clone https://github.com/rsupport-mobile1-research/unity-view.git

For this example all the source code in webrtc folder. In next step, we need to clone webrtc source code into webrtc folder at WebRTC lib

cd unity-view
cd webrtc
git clone https://github.com/rsupport-mobile1-research/flutter-webrtc.git

Alt text

ℹ️ Janus client

Clone main source code at Main repo

git clone https://github.com/rsupport-mobile1-research/unity-view.git

Move to unity-view folder and clone janus client source code into unity-view folder at Janus client lib and then move to flutter_janus_client to switch source branch stable_v2_dev branch

cd unity-view
git clone https://github.com/rsupport-mobile1-research/flutter_janus_client.git
cd flutter_janus_client
git checkout stable_v2_dev

Clone webrtc source code into flutter_janus_client folder at WebRTC lib

git clone https://github.com/rsupport-mobile1-research/flutter-webrtc.git

Alt text

ℹ️ MediaSoup

Clone main source code at Main repo

git clone https://github.com/rsupport-mobile1-research/unity-view.git

For this example all the source code in mediasoup folder. In next step, we need to clone mediasoup-client-flutter source code into mediasoup folder at Mediasoup client lib

cd unity-view
cd mediasoup
git clone https://github.com/rsupport-mobile1-research/mediasoup-client-flutter.git
cd mediasoup-client-flutter

Clone webrtc source code into mediasoup-client-flutter folder at WebRTC lib

git clone https://github.com/rsupport-mobile1-research/flutter-webrtc.git
git checkout main_media_soup

Alt text

Launch the demo

Android

Build androidlibrary from Unity

Open source code Unity

  • in webrtc/unity/DemoApp for testing with WebRTC
  • in unity/DemoApp for testing with Janus client
  • in mediasoup/unity/DemoApp for testing with Mediasoup

Alt text

Config build setting for android on Unity. Select File -> Build Settings. In the window, select Android platform and click on Player Settings below of the window. Select Player and find Multithreaded Rendering* option. We need to disable this option.

Alt text

Make sure Export Project is on

Alt text

Close the window and click on Switch Plaform on Build Settings popup & close the popup. Select Flutter -> Export Android Plugin. After done this step we will see unityLibrary under Android folder.

Continue to change config NDK on android. We need to add ndk.dir in local.properties of android folder at unity-view/android/local.properties with

 ndk.dir=/Applications/Unity/Hub/Editor/[ndk version]/PlaybackEngines/AndroidPlayer/NDK

Make sure you get the correct version of ndk by move to /Applications/Unity/Hub/Editor/ to get it

Alt text

Open unity_view folder by android studio. Add unity-classes.jar in android/unityLibrary as a library by right click on unity-classes.jar -> Add as library...

Alt text

Check if there are missing some files arcore_client.aar, ARPresto.aar, unityandroidpermissions.aar, UnityARCore.aar.

If missing, check config build on Unity setting again

Start an android device to build the app.

ℹ️ WebRTC

For mobile, you need to check your IP address to input to the demo. For mac we can go to Setting -> Open details of connected wifi and copy IP address. Example: 192.168.165.51

Run server Move to server folder at webrtc/server.

Use mkcert to create a self-signed certificate.

brew update
brew install mkcert
mkcert -key-file configs/certs/key.pem -cert-file configs/certs/cert.pem  localhost 127.0.0.1 ::1 0.0.0.0

Run

brew install golang
go run cmd/server/main.go

In case, you already setup golang & mkcert. Just need to move to server folder and run cmd

go run cmd/server/main.go

Open https://0.0.0.0:8086 to use flutter web demo.

On popup input address of web demo, just need to input localhost to run

ℹ️ Janus Client

Don't need build server local in this case Just need to build app on 2 devices to test

ℹ️ MediaSoup

Don't need build server local in this case Just need to build app on 2 devices to test

iOS

Build iOS library from Unity

Open source code Unity

  • in webrtc/unity/DemoApp for testing with WebRTC
  • in unity/DemoApp for testing with Janus client
  • in mediasoup/unity/DemoApp for testing with Mediasoup

Alt text

Then you do following Steps like this:

Step 1 Select menu 'File' -> Build Setting

Alt text

Step 2 Build Setting Panel Appear -> choose iOS -> Click Switch platform -> Click 'Payer Settings'

Alt text Alt text

Step 3 Be select all type property like the red squard in these images

Alt text Alt text

Step 4 Import package from folder 'Unity package'

Alt text Alt text

Step 5 Now, Export Plugin for iOS from unity. You should export 'Export iOS Debug' and 'Export iOS Plugin',Unity tool will auto export to folder ios in flutter project

Alt text Alt text

Step 6 Open folder 'unity-view' -> 'ios' -> Open Folder 'Runner.xcworkspace'. Then config like theses images

Alt text Alt text Alt text

Step 7 Add file for custom workflow WebRTC

Alt text Alt text Alt text

Step 8 Login your Developer Apple ID. Then register App bundle ID to build application on device.

Alt text Alt text

then you should setup all environment sdk flutter

Alt text

then you can build on device.

ℹ️ WebRTC

For mobile, you need to check your IP address to input to the demo. For mac we can go to Setting -> Open details of connected wifi and copy IP address. Example: 192.168.165.51

Run server Move to server folder at webrtc/server.

Use mkcert to create a self-signed certificate.

brew update
brew install mkcert
mkcert -key-file configs/certs/key.pem -cert-file configs/certs/cert.pem  localhost 127.0.0.1 ::1 0.0.0.0

Run

brew install golang
go run cmd/server/main.go

In case, you already setup golang & mkcert. Just need to move to server folder and run cmd

go run cmd/server/main.go

Open https://0.0.0.0:8086 to use flutter web demo.

On popup input address of web demo, just need to input localhost to run

ℹ️ Janus Client

Don't need build server local in this case Just need to build app on 2 devices to test

ℹ️ MediaSoup

Don't need build server local in this case Just need to build app on 2 devices to test

Reference docs

. Flutter Unity View

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5