Skip to content

AVPlayerItemVideoOutput.CopyPixelBuffer missing/broken #21702

@kiddkaffeine

Description

@kiddkaffeine

Apple platform

iOS, macOS

Framework version

net9.0-*

Affected platform version

9.0.100

Description

In Objective C, AVPlayerItemVideoOutput has a method called "CopyPixelBuffer", and the documentation suggests a similar version exists in C#:
https://learn.microsoft.com/en-us/dotnet/api/avfoundation.avplayeritemvideooutput.copypixelbuffer?view=xamarin-ios-sdk-12#avfoundation-avplayeritemvideooutput-copypixelbuffer(coremedia-cmtime-coremedia-cmtime@)

However, this method does not appear to exist.
1>TestFile.cs(55,25): Error CS1061 : 'AVPlayerItemVideoOutput' does not contain a definition for 'CopyPixelBuffer' and no accessible extension method 'CopyPixelBuffer' accepting a first argument of type 'AVPlayerItemVideoOutput' could be found (are you missing a using directive or an assembly reference?)

Using Rider to drill into the class, there does appear to be a method called "WeakCopyPixelBuffer" which returns an IntPtr but this method is protected and thus inaccessible.

Steps to Reproduce

  1. Create a net9.0-macos project
  2. Create an AVPlayerItemVideoOutput and attempt to invoke CopyPixelBuffer, eg
    videoOutput = new AVPlayerItemVideoOutput(); CMTime itemTime = videoOutput.GetItemTime((double)DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond); // CACurrentMediaTime()? videoOutput.CopyPixelBuffer(itemTime, null);

Did you find any workaround?

None so far.

I did find this in the repo:
https://github.com/xamarin/xamarin-macios/blob/d8fba3b358a11b9679df2b8029d2e4a8df91a3b4/src/AVFoundation/AVPlayer.cs#L20
And tried to replicate it with reflection, but it appears to call a constructor for CVPixelBuffer which doesn't exist?

Relevant log output

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions