A Swift package for synchronizing haptic feedback with video playback
HapticVideoSync
A Swift package for synchronizing haptic feedback with video playback.
Features
- Sync haptic feedback to specific timestamps in a video.
- High precision timing with
CMTime
. - Easy integration with AVFoundation’s
AVPlayer
.
Installation
Swift Package Manager
dependencies: [
.package(url: "https://github.com/rtemple6/HapticVideoSync.git", .upToNextMajor(from: "1.0.0"))
]
Usage
import HapticVideoSync
// Initialize AVPlayer
let player = AVPlayer(url: videoURL)
// Initialize HapticVideoSync with player and timestamps
let hapticSync = HapticVideoSync(player: player, timestampInSeconds: [2.5, 5.75, 10.0, 10.05, 14.9])
// Play video
player.play()
Contributing
Contributions are welcome! Please submit a pull request.