Last active
March 28, 2021 15:16
-
-
Save gtokman/d11e9584c5b353df288287b4f2dfdddd to your computer and use it in GitHub Desktop.
Video - example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import AVKit | |
| struct ContentView: View { | |
| @State var videos: [Video] = [] | |
| var body: some View { | |
| VideoView() | |
| .onReceive( | |
| NotificationCenter.default.publisher(for: .AVPlayerItemDidPlayToEndTime), | |
| perform: { info in | |
| // publisher sent a notification | |
| videos[selection].player.seek(to: .zero) | |
| videos[selection].player.play() | |
| }) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment