Videoplayer on WebGL


#1

Hello,
I am new to zappworks but have worked with unity and wanted to use the Unity Universal AR sdk to create a very simple webar. For that I used Unity 2020.3.19f and the sdk. I deleted the main camera, added the Zappar Camera and the Zappar Image Tracker. As a picture I used a trained QR-Code. Then I added a quad ontop of the trained image and added a videoplayer to the quad. For the video I used a .mp4 clip that I dragged into the Assets folder. Then I added the Videoplayer to the On Seen Event in the Image Tracker and set it on Videoplayer.Play().

Then I build the app and let it run in my browser. The image was recognized but the Video was not played. Is there a reason and more importantly a solution for this? And if it doesnt work for Unity, does Zappwork offer a product that yields better results?


#2

Hi @tm99,

The following post may help you in better understanding the problem: Video didnt play on browser but play correctly on unity editor

Unity WebGL doesn’t support playing video directly from assets! You can either place your video under StreamingAssets path or external file server, then you can provide the video URL as the source. Even then you would need to take care of following:

  • CORS in case of external file server
  • Browsers block any auto playing of video/audio and requires user interaction (touch/click) to start the video element. So triggering a play method from “OnSeenEvent” may not work as you would expect it.

Even after doing all that it’s not guaranteed to play across all browsers and devices. As it’s being tracked by Unity Issues.

Hope that helps (at least in understanding the issue form Unity side).

Best,


#3

I developed an asset to play videos on Unity WebGL. It should work with UniversalAR as well.