-
Notifications
You must be signed in to change notification settings - Fork 63
Fixing paused video doesn't react on changing device orientation #199
base: main
Are you sure you want to change the base?
Conversation
This will have some major performance impact. When we're paused, users would expect the app to be doing (almost) nothing. This would require us to regenerate the same image 30+ times a second. This would be better done in |
I know it's overhead, but it was the simplest solution. I tried to think your advice but:
returns wrong image size (image size from previous orientation) after resize and I have to call
to get correct new ones. So how can I do it, without calling Render() method. I understand I can't call render method because frame == prev_frame_ returns nill as result. |
The base image is always the same, it is based on the image data without any resizing. We use |
Sorry, you're right. Image dimensions are really same, I was wrong. I create new commit, where I reverse all previous patches and has working solution as you advice.
|
I updated all points, except superview workaround. I will try to figure out why view.bounds are wrong. UPDATE: |
Ok, I found better solution:
from inside another override function:
with this solution, I can use ShakaPlayer bounds instead of super view bounds, because they are updated from parent. |
Reacting on #194 I found that problem is in condiiton:
frame == prev_frame_
in
apple_video_renderer.cc
. It returnsnullptr
in this case andrenderLoop
insideShakaPlayerView.mm
doesn't pass:if (CGImageRef image = _player.videoRenderer->Render(nullptr, &aspect_ratio)) {..
condition
So solution would be remove
frame == prev_frame_
, but this could brings unnecessary overhead to rendering loop.So I limit this condition only for case, that video is paused. To make it possible, I have to make
player_
property protected, to be inheritable from parent class. Also I had to movemutex_
up to player_, due to some compilations errors.This works and bug is fixed.
I could imagine there should be better solution, directly in file
ShakaPlayerView.mm
- watching screen orientation change and only forcing recalculation in that case. Additionaly storing some informations from last render and use them for paused state. But I don't want to make huge updates in original source code.Fixes #194