Component

AVKit Integration

Learn to add AVKit Integration to your iOS App (Supports Xcode 16 and iOS 18)

AVKit Integration

Just copy the below code and modify according to your needs.

import AVKit
import SwiftUI

struct VideoPlayerView: View {
    private var player = AVPlayer(url: URL(string: "https://www.example.com/samplevideo.mp4")!)

    var body: some View {
        VStack {
            VideoPlayer(player: player)
                .frame(height: 300)
                .cornerRadius(10)

            HStack {
                Button("Play Video") {
                    player.play()
                }
                .font(.headline)
                .foregroundColor(.white)
                .padding()
                .background(Color.blue)
                .cornerRadius(8)

                Button("Pause Video") {
                    player.pause()
                }
                .font(.headline)
                .foregroundColor(.white)
                .padding()
                .background(Color.red)
                .cornerRadius(8)
            }
            .padding(.top, 20)
        }
        .padding()
    }
}

struct ContentView: View {
    var body: some View {
        VStack {
            Text("Welcome to Video Player")
                .font(.largeTitle)
                .padding()

            VideoPlayerView()
        }
    }
}

Time to build your iOS App?

ShipiOS provides you SwiftUI boilerplate, How-to Guides, Components Library and extra rewards!

Get ShipiOS Package
ShipiOS.App

I told you it's more than just a boilerplate :)

Made with ❤️ on 🌍

Need help? Reach out on:

© Copyright 2024 ShipiOS.App - All rights reserved.