Skip to content

liveview-native/liveview-native-swiftui-avkit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AVKit for LiveView Native SwiftUI

liveview-native-swiftui-avkit is an add-on library for LiveView Native. It adds AVKit support for video playback and other audiovisual capabilities.

Installation

  1. In Xcode, select File → Add Packages...
  2. Enter the package URL https://github.com/liveview-native/liveview-native-swiftui-avkit
  3. Select Add Package

Usage

Import LiveViewNativeAVKit and add .avKit to the list of addons on your LiveView:

import SwiftUI
import LiveViewNative
import LiveViewNativeAVKit

struct ContentView: View {
    var body: some View {
        #LiveView(
            .localhost,
            addons: [.avKit]
        )
    }
}

Now you can use the VideoPlayer element in your template.

<VideoPlayer
  url="videos/sample.mov"
  autoplay
  isMuted
  playbackTime={28}
  phx-debounce={1000}
  phx-change="player-changed"
/>
LiveView Native AVKit screenshot

Learn more

You can view documentation on the elements and attributes in this addon from Xcode:

  1. In Xcode, select Product → Build Documentation in the menu bar
  2. Select Window → Developer Documentation (Xcode should open this for you after the documentation is built)
  3. Select LiveViewNativeAVKit in the sidebar