RenderHeads / UnityPlugin-AVProVideo

AVPro Video is a multi-platform Unity plugin for advanced video playback
https://www.renderheads.com/products/avpro-video/
231 stars 28 forks source link

Can I use this plugin to play HLS in WebGL? #461

Closed Wudi-Unity closed 3 years ago

Wudi-Unity commented 4 years ago

Can I use m3u8 format URL to build WebGL at Unity3D? Because When I play in the unity simulator is OK But build to WebGL is Error....

AndrewRH commented 4 years ago

Yes we support WebGL. What is the error? Please use the bug report template to help give us the information we need to help you.

Wudi-Unity commented 4 years ago

I use Assets/AVProVideo/Prefabs/FullscreenVideo to my game scene. Source Path set "Absolute Path Or URL" and key the m3u8's URL In WebGL label, I select "WebGL"


If I set External Library : hls.js

When I open my web (build from Unity WebGL) It show:

An error occurred running the Unity content on this page. see your browser JavaScript console for more info. The error was:UncaughtError: HLS is not defined

=================================== But If I set External Library : none

It doesn't show error but the web is no streaming movie This is a Screenshot: https://drive.google.com/file/d/1usGjSjyjwOejptBjfxzGenYKJkQUfiEg/view?usp=sharing]

================================ This is my setting: https://drive.google.com/file/d/1_Zeqv806lckk-dsJIStaq3SJ_4QLkSPG/view?usp=sharing

https://drive.google.com/file/d/1mz2cVUXcmviV3sdFNhsw1T1UtS771G_Q/view?usp=sharing

AndrewRH commented 4 years ago

Did you integrate the hls.js library as in the documentation?

Wudi-Unity commented 3 years ago

No, I don't use hls.js. (Only select) If I build WebGL. Is this necessary?

Because.... If I select "none", that is no error

AndrewRH commented 3 years ago

Which browser are you using, and on which platform?

Most browsers don't have native HLS support (or it is disabled by default), so it's best to use the hls.js library - we have instructions in the documentation on how to do this.

Does that helps?

Wudi-Unity commented 3 years ago

Thanks for your help. I use Windows10 and Chrome. And I find this documentation information: ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ To add support for hls.js:

  1. In the MediaPlayer component set Platform Specific > WebGL > External Library to hls.js AVPro Video © 2016-2020 RenderHeads Ltd
  2. Build for WebGL
  3. Download the latest hls.js release (we tested with 0.10.1): https://github.com/video-dev/hls.js/releases
  4. Once your build is made, copy “hls.min.js” to the TemplateData folder
  5. Edit the index.html to add before the UnityLoader.js script is loaded. Ideally you would add this to a new WebGL template so that you don’t have to make these changes for each build.

    so... If I want to use m3u8 format, maybe I must add this hls.js

but if I want to use RTSP, can I directly use the RTSP URL?

Wudi-Unity commented 3 years ago

ps. my m3u8 format movie can be played smoothly. Thanks for your help ^^

AndrewRH commented 3 years ago

I'm glad to hear that ^_^ RTSP is not a format we support I'm afraid...I think we may support it on Android (using the MediaPlayer API and not the default ExoPlayer API), but in general it is not supported.

I will close this issue since it is resolved.

Thanks,