Allow multiple AVPlayer instances, use TextureView instead of SurfaceView#406
Allow multiple AVPlayer instances, use TextureView instead of SurfaceView#406michaelknoch wants to merge 24 commits intomasterfrom
Conversation
| // XXX: Should we just return _presentation if it already exists?? | ||
| // This seems to break animations, but why? | ||
| // if let _presentation { return _presentation } |
There was a problem hiding this comment.
@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 |
There was a problem hiding this comment.
@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) |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
@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?
ephemer
left a comment
There was a problem hiding this comment.
It looks good to me (I hope so because I think I wrote most of it)
* enhance error recovery * add eof * fix streching of video
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