RenderHeads / UnityPlugin-AVProVideo

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

When using AVPro 2/3 on Android. When trying to load a shared location AVPro fails to load the media #1845

Closed phileday closed 1 week ago

phileday commented 1 month ago

This is quite a difficult one to describe as recreating it isn't easy. I previously had the same issue on the PC version of the build which you fixed.

I retrieve the network location using the VLC unity plugin and then load that address. A couple of examples of these address are:

http://192.168.8.104:10243/WMPNSSv4/1247462796/1_OC05MjE2.mp4 smb://MYCLOUD-9AJYJ8/Public/Films/The.Hudsucker.Proxy.1994.1080p.BluRay.x264-%5BYTS.AM%5D.mp4

I'll deal with the first as I can also load this on the PC.

(note, all the videos I'm trying to load will load properly when loaded directly from the device)

So on the PC version you can load http://192.168.8.104:10243/WMPNSSv4/1247462796/1_OC05MjE2.mp4 and it will open as expected. When I try and load it on the Quest3 I get an error which is returned straight away.

The error I get is this: [AVProVideo] Error: Loading failed. File not found, codec not supported, video resolution too high or insufficient system resources. RenderHeads.Media.AVProVideo.MediaPlayer:UpdateErrors() RenderHeads.Media.AVProVideo.MediaPlayer:Update() Android 8 and above require HTTPS by default, change to HTTPS or enable ClearText in the AndroidManifest.xml RenderHeads.Media.AVProVideo.MediaPlayer:UpdateErrors() RenderHeads.Media.AVProVideo.MediaPlayer:Update()

I've added the ClearText to the AndroidManifest (android:usesCleartextTraffic="true") but the message still appears.

When trying to load this one: smb://MYCLOUD-9AJYJ8/Public/Films/Wonder%20Woman%201984.2020.1080p.WEB-DL.H264.DD5.1-EVO.mkv

I get this error and it takes a little time longer to appear. [AVProVideo] Error: Loading failed. File not found, codec not supported, video resolution too high or insufficient system resources. RenderHeads.Media.AVProVideo.MediaPlayer:UpdateErrors() RenderHeads.Media.AVProVideo.MediaPlayer:Update()

Both of these files will load in the VLC plugin on Android. I also use the same plugin on PC and the shared locations will appear and can be loaded in both VLC and AVPro in Media foundation and WinRT.

I can provide more information to help resolve this issue as it would be really good to have shared locations accessable in both VLC and Exoplayer/Media player on the Quest3.

OS - Android (Quest 3) Build level: minimum API Level - Android 11.0 (API level 30) Target API Level - Android 11.0 (API level 33) Unity - 2022.3.27f1 AVPro version - 2/3 Video spec - N/A issue happens on all videos

Chris-RH commented 4 weeks ago

Have you tried it with HTTPS? Have you tried it on another android device? Does the same video stream using Unity videoplayer on the same android device? Can you provide a full logcat of the error?

phileday commented 4 weeks ago

Hi, thanks for the reply. I will need to do some more testing to get all the answers which I should have time to do on Wednesday. I'l try and answer now though as best as I can.

Have you tried it with HTTPS? I did try changing the http to https as I can remember but it didn't work. I'll have to retest this to confirm. When I retest is there any other options I could also try?

Have you tried it on another android device? Pico4VR, Quest2 and Quest3.

Does the same video stream using Unity videoplayer on the same android device? Not sure. I've only tested it using the VLC plugin not the videoplayer. I could also give that a go.

Can you provide a full logcat of the error? The error above is what appears when you try and load the stream. I can provide a full logcat if that helps.

I'll provide more information on Wednesday. If there is anything I can provide please let me know.

Phil

MorrisRH commented 2 weeks ago

The Android MediaPlayer and ExoPlayer APIs (which we use internally) do not support the smb protocol so this will not work until such time the Android developers decide to add support for it.

I successfully played back a video via http using the ExoPlayer API on the Quest2. It did require adding a 'Custom Main Manifest' with the following modification:

<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.unity3d.player"
    xmlns:tools="http://schemas.android.com/tools">
    <application
        android:usesCleartextTraffic="true">
        <activity android:name="com.unity3d.player.UnityPlayerActivity"
                  android:theme="@style/UnityThemeSelector">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
        </activity>
    </application>
</manifest>