Skip to content

Instantly share code, notes, and snippets.

@gtokman
Last active March 28, 2021 15:16
Show Gist options
  • Select an option

  • Save gtokman/d11e9584c5b353df288287b4f2dfdddd to your computer and use it in GitHub Desktop.

Select an option

Save gtokman/d11e9584c5b353df288287b4f2dfdddd to your computer and use it in GitHub Desktop.
Video - example
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