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

fix: video crashes #70

Merged
merged 2 commits into from
Aug 23, 2024
Merged

fix: video crashes #70

merged 2 commits into from
Aug 23, 2024

Conversation

saeedbashir
Copy link

App was crashing in two cases of videos, both the crashes can be tested on course Project Management for Development

  1. When the LMS is returning an empty URL for video encoding

How it can be tested:
It can be tested on the first section, Start here -> 0.1 Welcome to the course -> going to the video
Solution:
Mimic the behaviour from the old app.
2. When the LMS returns wrong data for transcripts, LSM is returning less time for endtime than the starttime of the transcript.

How it can be tested:
1. Go to Videos tab
2. Go to Module 1: Project Chapter
3. Go to 1.1.5 Video: Project Chapter (can be selected from the dropdown switcher)
4. Go to the video component

@@ -72,7 +72,11 @@ public class VideoPlayerViewModel: ObservableObject {

playerHolder.getTimePublisher()
.sink {[weak self] time in
self?.currentTime = time
if time.isNaN {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Better to move that condition to PlayerHolder where publisher send time value

Copy link
Collaborator

@forgotvas forgotvas left a comment

Choose a reason for hiding this comment

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

LGTM, but what do you think about to add same check to 138 line inside addPeriodicTimeObserver closure:

private func observe() {
....
        timeObserver = player?.addPeriodicTimeObserver(forInterval: interval, queue: .main) {[weak self] time in
            self?.timePublisher.send(time.seconds)
        }

@saeedbashir
Copy link
Author

137

It's a PeriodicTimeObserver so it will only call when there is any change in the video playback and in that case the value shouldn't be nan.

@forgotvas
Copy link
Collaborator

137

It's a PeriodicTimeObserver so it will only call when there is any change in the video playback and in that case the value shouldn't be nan.

ok i just not sure that this closure will always have correct value. If you are sure then ok.

@saeedbashir saeedbashir merged commit 8d4b778 into 2U/develop Aug 23, 2024
3 checks passed
@saeedbashir saeedbashir deleted the saeed/fix_video_crash branch August 23, 2024 03:59
saeedbashir added a commit that referenced this pull request Aug 23, 2024
rnr pushed a commit that referenced this pull request Sep 6, 2024
rnr added a commit that referenced this pull request Sep 30, 2024
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