[Released] AVPro Video - complete video playback solution

Hi, I have the following problem with MediaPlayer on macOS: I want to use MediaPlayer with Unity Audio. In MediaPlayer, I have set the AudioOutput to “Unity” in the settings for macOS. When the loaded video is played for the first time, the sound comes through Unity Audio, as desired. However, on repeated playback (loop, stop / play), the sound no longer comes through Unity Audio, but is output directly.

This can be easily tested in the editor: Load a movie with audio into the MediaPlayer, activate “loop” and play the video in the Inspector (in editor mode). Since the sound is supposed to come via the AudioSource, nothing is correctly heard. When the video starts again from the beginning, you hear the sound via the direct output, which should not be the case.

Or you send the output of the AudioSource into an AudioMixerGroup, and watch the level meter (in play mode). During the first pass of the video you see the audio signal on the level meter, from the second pass on you don’t see it anymore.

I hope you have a solution for this.

Edit: I have since done builds for macOS and iOS to test the behavior, and unfortunately the problem also occurs in the build for both platforms.

Forgive me if this has been asked before…Is it possible to replicate the Unity Camera’s “Field of view” in your software?
Sometimes I will set the main camera field of view to be 70 or even 90 but when recording the scene/project your capture app takes the camera back to the default 60 field of view. Can this (field of view) be changed using some method or another ?
EDIT. Sorry…meant to mention this is on the component “capture from camera360”.

Hi I’ve noticed that if the Demo_MediaPlayer scene is streaming video via URL in a WebGL build, the video does not play in Safari Mac if sound is enabled, but does is sound is muted. Can this be fixed somehow? Safari iOS works fine btw as well as all the browsers I’ve tested

Hi @ElCapitanPupuPipi ,

We don’t officially support WebGL, mostly because of various issues that come up with browser compatibility.

For Safari, you need to make sure you are using WebGL 1.0.
Are you auto-playing the media? In Safari, videos are not allowed to auto-play unless given permission by the user (in the preferences menu). This doesn’t affect videos that have no audio track. More details can be found here: https://webkit.org/blog/7734/auto-play-policy-changes-for-macos/ I wonder if you could start the video muted and then unmute it after a few frames?

Kind regards,
Chris

@vertexx

No, its not possible.

Kind regards,
Chris

Hi @SB1 ,

That’s strange.
Can you reproduce this in a fresh project using just AVPro video?
What version of AVPro Video are you using?
Which Unity version are you using?
Which macOS/iOS version?
What are the specs of the videos used (codecs, resolution, FPS etc)?
Are the videos streamed or played locally?

Kind regards,
Chris

For anyone who is encountering the following error when building a Unity 2022 project for the Meta Quest with AVPro:

Compilation target for module ':launcher' is 'android-32'```

This error is due to Exoplayer requiring a min SDK level of 33 due to a Google Play Store requirement, but Meta requires a min SDK level no higher than 32 (as of 2023/11/01) so you cannot actually set the min SDK level to 33 otherwise Meta's build uploader will reject your build. In order to build with a min SDK level of 32 and bypass the error, you you must patch your installation of Unity 2022:

1. In Unity, set the 'Minimum API Level' to Level 32. For the Meta Quest, you cannot currently set it any higher than this.
2. Navigate to C:\UnityEditor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\GradleTemplates
3. Create a backup of mainTemplate.gradle and launcherTemplate.gradle
4. Open mainTemplate.gradle in a text editor and change the line compileSdkVersion **APIVERSION** to compileSdkVersion 33
5. Change the line targetSdkVersion **TARGETSDKVERSION** to targetSdkVersion 32
6. Repeat steps 3 and 4 for launcherTemplate.gradle
7. Install Unity 2023 (I installed 2023.1.19f1) and navigate to the folder C:\UnityEditor\2023.1.19f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms
8. Copy the android-33 folder into your Unity 2022 installation folder C:\UnityEditor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms
9. Build the project and it should now work.

More discussion about the problem can be found [here](https://github.com/RenderHeads/UnityPlugin-AVProVideo/issues/1652).

AVPro Video version 2.9.0 has just been released!

DOWNLOAD THE FREE TRIAL VERSION HERE

Changes include:

General

  • Enhancements

  • #1059 | #1552 Added Paused and Unpaused events

  • #1627 | #1490 Added support for handling video orientation into the ResolveToRenderTexture component

  • Fixes

  • #1639 Fixed incorrect transform for videos that are landscape flipped

Android

  • Changes

  • Upgraded ExoPlayer from 2.19.0 to 2.19.1

  • Fixes

  • When using the Unity audio pipe, samples from the buffer are now no longer drained/returned when video is paused

  • Enhancements

  • Added ability to ‘force enable media codec asynchronous queueing’ in ExoPlayer

iOS

  • Fixes

  • #1653 Fixed issue with Unity audio output mode failing due to changes in how the audio processing tap works with iOS 17

  • #1671 Disabled audio spectrum visualisation in the Media Player demo scene on iOS due to it causing GPU issues on certain devices with iOS 17

Download Links

Editions

On the Unity Asset Store we’ve made several editions of AVPro Video available so you can pick the one that’s best for your project:

Core Edition
Core Windows Edition
Core Android Edition
Core macOS/iOS/tvOS Edition
Ultra Edition
• Enterprise Edition (contact us for multi-site licensing / support options)

You can read this page to learn more about the features, pricing and upgrades for the different editions.

DOWNLOAD THE FREE TRIAL VERSION HERE

Thanks to everyone who reported bugs or feature requests! We’re looking forward continuing to support this product into the future and adding more features.

Please report any issues to our Github Issues

Hi,
I wrote a simple backend-solution which is deployed on Azure to stream videos which are stored in an Azure blob storage back to the client. I need to send a Bearer Token for authorization because the service app is not configured for anonymous access.

To test the general approach with AVPro Video, I setup a sample scene with AVPro trial version and I created a new Azure service app on anonymous access level with the same implementation in the endpoint. If I set the URL to this endpoint in the AVProVideo-component, everything works fine → the video is played correctly in the player.

If I set the URL of the endpoint to that controller in my token-based service app and I provide the Azure token by a custom HTTP Authorization Header, the code in the endpoint is entered (I can set a breakpoint there and the execution stops correctly) but the video isn’t played and an error is shown in the Unity console: Error: Loading failed. File not found, codec not supported, video resolution too high or insufficient system resources.

In your documentation it says: Custom HTTP header fields can be specified which can help with server side validation (requires using the WinRT API). This is only supported for adaptive media (HLS/DASH).

I don’t have adaptive media and I don’t need it because I need the possibility to play videos in a company environment.

Would it be possible to extend the asset to just support Custom Http Headers like Authorization with Bearer Token for “normal” streamed videos?

Hi @LoneSurvivor82_1

Its now one of our possible future enhancements on github.

Kind regards,
Chris

1 Like

@Chris-RH

I previously posted about a flicker that was happening in Media Foundation for some users (see post above). I’ve been sent an example of this happening on one of the users system:

I experience this sometimes on my works system but not to this extent. Note that this isn’t happening when using WinRT and that in the example video in the youtube video is actually paused. You didn’t reply to my previous message, although you had released a new version so I think it just got lost in the mix. The example in the video is also using the latest AVPro Ultra build.

If I can provide more information let me know.

Phil

Hi @phileday

It could be related to the GPU decoder being worked too hard - perhaps check in Task Manager > Performance > GPU tab to make sure the GPU video decoder isn’t too high.
It would be interesting to compare the results that you get using WinRT, Media Foundation and DirectShow. Also, out of interest, do you get the black flashes when using DirectShow?

It would be interesting to know what GPU they are using. I wonder if a particular type is more prone to it. Also, are they using up to date GPU drivers.

I would also disable anything not being used such as ‘stereo support’ and ‘hap/notchlc support’ and see if that helps.

Another thing to test it to disable the audio, as it could be to do with the audio sample rate.

Are all the streams that are being tested Youtube streams or are they from other sources too? It would be useful to know the specs of the video (and its audio).

Kind regards,
Chris

Hi, do you have any plan of supporting the SRT video protocol for AVPro ?

Hi @Orkhyd ,

It’s not natively supported on any of the platforms at the moment, so quite unlikely in the short term.

Kind regards,
Chris

This is the weird thing. Whenever I’ve seen the issue it’s been on a more powerful computer than my own. In fact I can max out the GPU on my own computer without getting the issue.

The biggest problem I’ve got is that I can’t find a way to recreate it. It works fine on my lower powered machine.

Regarding the content, it appears to mostly be of the adult Varity. These tend to be very high resolution and stereo.

Interesting you mention Stereo support. So in Whirligig all stereo work is done by me. I go into the apply to materials script and remove all the reformatting of any materials. The only thing I want the player to do it display the full frame without trying to do any stereo formatting itself. This used to be a problem as Media Foundation tried to take over the stereo rendering and would only show one eye. You now have a way of disabling that behavior which I use. Is there any chance it could be to do with that?

Sorry I can’t be more useful. I’ve only had this reported to me and very rarely I see it on my work PC (not my PC) which is the higher end one. The GPU in that is NVidia GeForce RTX 3080.

I’ll look into your suggestions and see if I can come up with a better way of recreating the issue. Thanks for the help.

Phil

AVPro Video version 2.9.1 has just been released!

DOWNLOAD THE FREE TRIAL VERSION HERE

Changes include:

Android

  • Enhancements

  • #1706 Added Facebook360 audio latency setting

  • Fixes

  • #1679 Audio output whilst not playing issue fix

  • #1694 MediaPlayer API path crash fix

iOS/macOS/tvOS

  • Fixes

  • #1704 Fixed issue with the path component of a file URI not being correctly encoded

Download Links

Editions

On the Unity Asset Store we’ve made several editions of AVPro Video available so you can pick the one that’s best for your project:

Core Edition
Core Windows Edition
Core Android Edition
Core macOS/iOS/tvOS Edition
Ultra Edition
• Enterprise Edition (contact us for multi-site licensing / support options)

You can read this page to learn more about the features, pricing and upgrades for the different editions.

DOWNLOAD THE FREE TRIAL VERSION HERE

Thanks to everyone who reported bugs or feature requests! We’re looking forward continuing to support this product into the future and adding more features.

Please report any issues to our Github Issues

Hi, we’re currently playing VP8 videos with transparency using the base VideoPlayer unity class. These have been working great on the Windows Editor, Pico 2, Pico 3, and Quest 2. But with the Quest 3, we get an encoding error on the same videos.

If we swap from Unity’s VideoPlayer to AVPro Video, will our videos play on the Quest 3? The codec error we get is:


and

We are a bit concerned that this error would occur on the Quest 3 with our videos regardless of the video player.

Hi @AndyKorth_1 ,

We don’t have a Quest 3 for testing. You are welcome to test using our free, watermarked trial version: Releases · RenderHeads/UnityPlugin-AVProVideo · GitHub
We only support transparency in VP8 if packing is used.
Have you tried a non-transparent VP8?
Does the Quest 3 actually support VP8?

Kind regards,
Chris

Thanks for the reply Chris:

This VP8 video works on the Quest 3 in the Unity VideoPlayer:

This VP8 video does not:

They were encoded by different team members, likely with different software. They both work on the Quest 2 and have transparency.

I am looking with ffprobe and I note that the working video was encoded with libwebm-0.3.0.0 and the non-working videos were encoded with libwebm-0.2.1.0:

I think I will spend today experimenting with the plugin, thanks for your help. Ideally we (I) don’t want to re-encode all the content in the app.

Oh I guess one weird thing to add, none of our VP8s work unless unity transcodes them which is an awful experience for the whole team. So Unity is transcoding both those files with the same import settings and ends up with one of them not working.