Closed phileday closed 1 week ago
That's weird. It definitely used to occur (https://github.com/RenderHeads/UnityPlugin-AVProVideo/issues/1179). Is this both Android mediaplayer and Exoplayer?
I noticed it with Exoplayer for sure as that's what I test with. I'm pretty sure it was true for Mediaplayer also but I would have to double check that later.
I can make a build of my app with debugging for the events if that would help.
I also have this issue. ReadyToPlay and FirstFrameReady are not called on Android Builds running on both Google Pixel 6 and Xiaomi Pad 6.
Platform: Android Unity Version: 2022.3.24f1 AVPro: v3 trial
Are you using autoplay? ReadyToPlay isn't called if you enable autoplay. I've tested on my S9 with the mediaplayer demo scene and I'm getting both ReadyToPlay and FirstFrameReady. I'm using Unity 2021. I'll retest with 2022.
Hi I actually turn on auto play depending on the users settings (play on load of media). I think most of the time it's on though so that would explain why it's not appearing. Is this intended? ultimately What I'm looking for is an event call that guarantees that all the info I need to request is available. In my case all the meta data, the resolution, audio tracks, number of audio channels on track, subtitle tracks, duration. In the past I didn't use the event call as I wasn't familiar with it so I would use a coroutine to delay the reading of all the data. After I've implemented the event system now the delay is mostly unnecessary however I do still delay before reading depending on the video path. Media Foundation I delay 20 ticks before reading all the data and WinRT I delay 150 ticks as I've found it wouldn't always read the resolution correctly. On Android I delay 20 ticks on both Exoplayer and Mediaplayer. Hope that helps. Phil Twitter - https://twitter.com/whirligigxyzBlog - http://www.whirligig.xyz/blogYoutube - https://www.youtube.com/channel/UC1MI0yclkwQjWjLw5bviXtg
On Tuesday, 14 May 2024 at 09:58:08 BST, Chris-RH ***@***.***> wrote:
Are you using autoplay? ReadyToPlay isn't called if you enable autoplay. I've tested on my S9 with the mediaplayer demo scene and I'm getting both ReadyToPlay and FirstFrameReady.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
Are you using autoplay? ReadyToPlay isn't called if you enable autoplay. I've tested on my S9 with the mediaplayer demo scene and I'm getting both ReadyToPlay and FirstFrameReady. I'm using Unity 2021. I'll retest with 2022.
No autoplay is always false in my project.
Hi @phileday,
You should try FirstFrameReady instead.
@edward-jones-wi,
Which events are you getting in the run up to playback?
I only get StartedBuffering and FinishedBuffering
@edward-jones-wi
So if you put this script in your project, with autoplay disabled, you should get events such as ReadyToPlay, MetaDataReady and FirstFrameReady? Could you do this in a new project and provide a full logcat please
Hi @Chris-RH,
I work with @edward-jones-wi so I've been helping to investigate this issue.
I tested this in a blank project using the Demo_MediaPlayer scene and the events fire correctly. After some further testing I have found the issue is related to the Android "file offset" feature. We use this in our project because all of our videos are loaded from Android Asset Packs.
I have created a test video (attached) using the instructions found in the documentation:
copy /b BigBuckBunny-360p30-H264.mp4.meta + BigBuckBunny-360p30-H264.mp4 OffsetTest.mp4
If I use this video in the demo scene and set the offset to 144 bytes (the size of the meta file), it fails to play on device and these are the only events that appear in the log:
[AVProVideo] Initialising AVPro Video v3.0.0 (native plugin v3.0.0-trial) on Mali-G78/Vulkan 1.1.0 [0x0b800000] (MT True) on Android
[AVProVideo] Opening jar:file:///data/app/~~Kzecu6P3CNgohsgoFkYyeA==/com.DefaultCompany.AVProImport-xj0xPGJ6dNV2QT4RZ-feZg==/base.apk!/assets/AVProVideoSamples/OffsetTest.mp4 (offset 144) with API ExoPlayer
MediaPlayer MediaPlayer generated event: StartedBuffering
MediaPlayer MediaPlayer generated event: FinishedBuffering
It seems to me like the native plugin is just ignoring the specified offset and trying to play from byte 0.
Cheers, Lee
Ahh, ok, that's interesting, thanks. Will look into that.
Hi @Chris-RH,
I work with @edward-jones-wi so I've been helping to investigate this issue.
I tested this in a blank project using the Demo_MediaPlayer scene and the events fire correctly. After some further testing I have found the issue is related to the Android "file offset" feature. We use this in our project because all of our videos are loaded from Android Asset Packs.
I have created a test video (attached) using the instructions found in the documentation:
copy /b BigBuckBunny-360p30-H264.mp4.meta + BigBuckBunny-360p30-H264.mp4 OffsetTest.mp4
OffsetTest.mp4 If I use this video in the demo scene and set the offset to 144 bytes (the size of the meta file), it fails to play on device and these are the only events that appear in the log:
[AVProVideo] Initialising AVPro Video v3.0.0 (native plugin v3.0.0-trial) on Mali-G78/Vulkan 1.1.0 [0x0b800000] (MT True) on Android [AVProVideo] Opening jar:file:///data/app/~~Kzecu6P3CNgohsgoFkYyeA==/com.DefaultCompany.AVProImport-xj0xPGJ6dNV2QT4RZ-feZg==/base.apk!/assets/AVProVideoSamples/OffsetTest.mp4 (offset 144) with API ExoPlayer MediaPlayer MediaPlayer generated event: StartedBuffering MediaPlayer MediaPlayer generated event: FinishedBuffering
It seems to me like the native plugin is just ignoring the specified offset and trying to play from byte 0.
Cheers, Lee
A FileOffset bug was fixed in v3.0.2 @WI-Lee
I just tried the demo scene again using v3.0.2 (I assume #1881 is the relevant issue here).
If I specify the offset in the inspector, the video plays correctly now. However, it still doesn't work if I specify the offset programmatically, e.g:
mediaPlayer.PlatformOptionsAndroid.fileOffset = 144;
mediaPlayer.OpenMedia(MediaPathType.AbsolutePathOrURL, path, true);
It seems to always use the initial offset and ignore any changes (we reuse the same MediaPlayer instance for multiple videos).
Ok, thanks for checking. Will take another look here doing it via script.
A fix for this will be in the next release (v3.0.3).
AVPro Video version 3.0.3 has been released. Please let us know if it has not fixed your issue.
In my player I listen out for 3 events to then process the video:
MediaPlayerEvent.EventType.ReadyToPlay MediaPlayerEvent.EventType.FirstFrameReady MediaPlayerEvent.EventType.MetaDataReady
and once all three have happened I then process the video. This insures that I can access file knowing it's fully loaded.
On Android MediaPlayerEvent.EventType.ReadyToPlay never occurs. This isn't a massive problem as I can just test for the other two but I though it was worth reporting. This also happens on both AVPro 2/3
OS - Android (Quest 3) Unity - 2022.3.27f1 AVPro version - 3 Video spec - N/A issue happens on all videos