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

WebGL unable to load HLS stream #331

Closed Twyker closed 4 years ago

Twyker commented 4 years ago

Hi!

Describe the bug I seem to be having the exact problem as stated here: https://github.com/RenderHeads/UnityPlugin-AVProVideo/issues/327

But the solution doesn't work for me. I did activate CORS for the test server. I did put in the hls.min.js as well as the map into the Template folder and call it before the Unity script in the index.html. I did allow everything on every browser, meaning insecure content, video and audio. I'm opening the video with MediaPlayer.OpenVideoFromFile(MediaPlayer.m_VideoLocation, MediaPlayer.m_VideoPath, false); and waiting for the MediaPlayerEvent.EventType.ReadyToPlay to trigger the MediaPlayer.Control.Play();

Tried different Chromium browsers as well as Firefox. Same error on all of them.

Your Setup:

Logs Error: video not supported (errorcode=4) color:red; [AVProVideo] Error: Loading failed. File not found, codec not supported, video resolution too high or insufficient system resources. (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)

AndrewRH commented 4 years ago

Hi,

Thanks for reporting the issue. In the other post he seems to have been able to get it working just fine. I wonder why it's not working for you.

Some of the events don't trigger in WebGL, so have you tried not waiting for an event and just doing AutoPlay?

Did you set the use of HLS.JS in the Platform Specific > WebGL options on the MediaPlayer component?

Did you try different HLS sources?

Thanks,

Twyker commented 4 years ago

I tried to call the Play manually via a UI button, I going to try it with AutoPlay real quick. I read about the FirstFrame issue as well, so I thought I'd couple it to a different event that seems to be working in browser, but oh well. :)

I did set the HLS.JS in the WebGL options of the MediaPlayer component. The test URLs in the PDF are producing the same errors sadly.

AndrewRH commented 4 years ago

Microsoft Edge has native HLS support, so that should definitely work (even without using the HLS.JS)...Let me know how it goes with your test. If you don't have any luck I will try to build using your Unity version to see if that reveals anything.

Twyker commented 4 years ago

Well, the new Edge is Chromium based so not much of a change there. The older one doesn't even load the project cause of the graphics API it uses.

Did try to get native HLS support via plugins, but to no avail.

I did however buy AVPro already. Gonna see if that helps. ;)

Twyker commented 4 years ago

Ok. This issue has been resolved. I'm just stupid, is all. I had the MediaPlayer component on a GO that was part of an addressable asset. After adding the HLS.js setting, I forgot to rebuild the addressables.

Thanks @AndrewRH ! :)

AndrewRH commented 4 years ago

Glad you managed to resolve it :) Best of luck!

adrw2 commented 4 years ago

Hi @Twyker Im having the same issue, after following the steps from #327 livestream videos dont load.

i didnt undertand well what you meant in your last sentence: "I forgot to rebuild the addressables."

could you show how you finally achieved it? i would appreciate it!

Twyker commented 4 years ago

@adrw2 Hi! Are you actually using Addressables in your project? If you don't then this would not apply in your case. :) I had the main RenderHeads component on an "addressable gameobject" but I did not rebuild/update it in the database, so the RenderHeads component was not actually on it/the HLS setting was not set.

So if you're having the same setup as me, just make sure you update/rebuild your addressables database. In general: The HLS setting must be set in the options on the MediaPlayer component (scroll to the bottom) and add the hls.min.js file to the WebGL files of your project (TemplateData). As far as I can tell, that's usually the problem most people run into. :)