Skip to content

Conversation

@michaelknoch
Copy link
Member

Type of change: feature

Motivation (current vs expected behavior)

Allow multiple AVPlayer instances, use TextureView instead of SurfaceView

Please check if the PR fulfills these requirements

  • Self-review: I am confident this is the simplest and clearest way to achieve the expected behaviour
  • There are no dependencies on other PRs or I have linked dependencies through Zenhub
  • The commit messages are clean and understandable
  • Tests for the changes have been added (for bug fixes / features)

@michaelknoch michaelknoch requested a review from ephemer as a code owner October 10, 2025 12:35
Comment on lines +227 to +229
// XXX: Should we just return _presentation if it already exists??
// This seems to break animations, but why?
// if let _presentation { return _presentation }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michaelknoch this is kind of an open question to you I think. We don't need to answer it right now but I it did confuse me that we create a new presentation layer on every frame – is that how iOS works?


let format: GPU_FormatEnum = switch channels {
case 1: GPU_FORMAT_ALPHA
case 2: GPU_FORMAT_LUMINANCE_ALPHA
Copy link
Member

@ephemer ephemer Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michaelknoch FYI in theory GPU_FORMAT_LUMINANCE_ALPHA (and GPU_FORMAT_ALPHA) is not supported in OpenGLES in versions 3+. So this "should" not work on newer devices. In practice I saw that Android emulates OpenGLES2 in these cases, so it works. I don't think it's problematic, but I wanted to mention it.

I didn't immediately find a way to see if this device is running OpenGLES2 vs OpenGLES3 – if we can find that we could also fall back to using 4-channel textures in that case. But let's see if it's actually a problem first


let rw = SDL_RWFromMem(ptr, Int32(buffer.count))
return GPU_LoadImage_RW(rw, true)
#elseif os(macOS)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not sure we need elseif os(macOS) here – it should be just "else"

// `newValue` is the HIDDEN state, whereas we're setting the _VISIBILITY_ here:
visibility = if (!newValue) { View.VISIBLE } else { View.INVISIBLE }
// Note: there is another visibility state, `View.GONE`, which also removes the view
// from layout (similar to `display: none`), but we want to match iOS behaviour here.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michaelknoch actually i'm unsure if GONE isn't a closer match to iOS behaviour. We kind of don't care about the layouting either way though because essentially our views are positioned absolutely. Either way, GONE might actually make more sense? Do you have any thoughts about it?

Copy link
Member

@ephemer ephemer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me (I hope so because I think I wrote most of it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants