Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 19 commits into from
May 16, 2024

Conversation

forgotvas
Copy link
Contributor

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

A little refactor how players is build in.

@forgotvas forgotvas linked an issue May 3, 2024 that may be closed by this pull request
@shafqat-muneer shafqat-muneer self-requested a review May 7, 2024 14:37
@shafqat-muneer
Copy link
Contributor

@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

@shafqat-muneer
Copy link
Contributor

@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
Copy link
Contributor

@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?

Comment on lines 16 to 18
init(playerController: AVPlayerViewController) {
self.playerController = playerController
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe we can safely remove this initializer.

Comment on lines 132 to 131
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Trailing Whitespace Violation

Comment on lines 147 to 150
.store(in: &cancellations)


NotificationCenter.default.publisher(for: AVPlayerItem.didPlayToEndTimeNotification, object: player?.currentItem)
Copy link
Contributor

Choose a reason for hiding this comment

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

Vertical Whitespace Violation

Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: SubtittlesView to SubtitlesView

@forgotvas
Copy link
Contributor Author

@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 forgotvas requested a review from shafqat-muneer May 9, 2024 12:33
@shafqat-muneer
Copy link
Contributor

@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. 🎉

shafqat-muneer
shafqat-muneer previously approved these changes May 9, 2024
@volodymyr-chekyrta volodymyr-chekyrta merged commit 32bf7d9 into openedx:develop May 16, 2024
3 checks passed
@forgotvas forgotvas deleted the fix/player-completion branch June 20, 2024 14:38
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.

[iOS] Completion doesn't work for videos in PiP mode.
3 participants