openedx / openedx-app-ios

The mobile app for iOS for the Open EdX Platform.
Apache License 2.0
19 stars 13 forks source link

[iOS] Completion doesn't work for videos in PiP mode. #414

Closed forgotvas closed 1 month ago

forgotvas commented 2 months ago

Fix bug for: [iOS] Completion doesn't work for videos in PiP mode. #391

A little refactor how players is build in.

shafqat-muneer commented 1 month ago

@forgotvas I just noticed that even though the video is still playing in PiP mode, when I return from other screens, it appears as if the module has been completed.

https://github.com/openedx/openedx-app-ios/assets/11990137/9d5c517b-8fd5-43b1-9d60-77a33eb3633a

shafqat-muneer commented 1 month ago

@forgotvas I just noticed that even though the video is still playing in PiP mode, when I return from other screens, it appears as if the module has been completed.

PiP.Mode.Video.mov

I came across this code snippet, and it appears to be functioning as intended, so there's no need to make any changes to it. 🎉

if strongSelf.playerTracker.progress > 0.8 && !strongSelf.isViewedOnce {
                    strongSelf.isViewedOnce = true
                    Task {
                        await strongSelf.sendCompletion()
                    }
                }
shafqat-muneer commented 1 month ago

@forgotvas I'm curious to understand what happens if a user downloads a video and watches it offline. Does the system recognize it as complete once the user reconnects online?

forgotvas commented 1 month ago

@forgotvas I'm curious to understand what happens if a user downloads a video and watches it offline. Does the system recognize it as complete once the user reconnects online?

Hi @shafqat-muneer, you are right, it will try to call the completion request, but as we are offline it will not be send. Also in current implementation i don't see that we are syncing it after return to online mode. But that PR is fixing problem when we call completion for videos what you are playing in PIP mode, to solve offline sync we need to create another task & PR. @sergeymomot could create ticket for that.

I have fixed code that you requested to change. Thank you for review.

shafqat-muneer commented 1 month ago

@forgotvas I'm curious to understand what happens if a user downloads a video and watches it offline. Does the system recognize it as complete once the user reconnects online?

Hi @shafqat-muneer, you are right, it will try to call the completion request, but as we are offline it will not be send. Also in current implementation i don't see that we are syncing it after return to online mode. But that PR is fixing problem when we call completion for videos what you are playing in PIP mode, to solve offline sync we need to create another task & PR. @sergeymomot could create ticket for that.

I have fixed code that you requested to change. Thank you for review.

@forgotvas It makes sense to me. I've looked over the requested changes, and we are good to merge. 🎉