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

Video start playing by subtitle taps #145

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Course/Course/Presentation/Video/EncodedVideoPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public struct EncodedVideoPlayer: View {
preferredTimescale: 10000
)
)
viewModel.controller.player?.play()
pauseScrolling()
currentTime = (date.secondsSinceMidnight() + 1)
})
Expand All @@ -108,6 +109,7 @@ public struct EncodedVideoPlayer: View {
preferredTimescale: 10000
)
)
viewModel.controller.player?.play()
pauseScrolling()
currentTime = (date.secondsSinceMidnight() + 1)
})
Expand Down
26 changes: 15 additions & 11 deletions Course/Course/Presentation/Video/YouTubeVideoPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,24 @@ public struct YouTubeVideoPlayer: View {
Spacer()
}
}
SubtittlesView(
languages: viewModel.languages,
currentTime: $viewModel.currentTime,
viewModel: viewModel, scrollTo: { date in
viewModel.youtubePlayer.seek(to: date.secondsSinceMidnight(), allowSeekAhead: true)
viewModel.pauseScrolling()
viewModel.currentTime = date.secondsSinceMidnight() + 1
ZStack {
SubtittlesView(
languages: viewModel.languages,
currentTime: $viewModel.currentTime,
viewModel: viewModel, scrollTo: { date in
viewModel.youtubePlayer.seek(to: date.secondsSinceMidnight(), allowSeekAhead: true)
viewModel.youtubePlayer.play()
viewModel.pauseScrolling()
viewModel.currentTime = date.secondsSinceMidnight() + 1
}
)
if viewModel.isLoading {
ProgressBar(size: 40, lineWidth: 8)
}
)
}
}
}
if viewModel.isLoading {
ProgressBar(size: 40, lineWidth: 8)
}

}
}
}
Expand Down