ludio
安装
Ludio 可通过 CocoaPods 获取。要安装它,只需将以下行添加到 Podfile 中
pod 'ludio'
import ludio
视频播放
//Create a ludio configuration
let configuration = LudioPlayerConfiguration(loopVideo: true, autoplay: false)
// Create the player
self.ludioPlayer = LudioPlayer(view:self.playerView!, configuration: configuration);
// Add yourself as a listener for events
self.ludioPlayer?.add(listener: self)
// Load a video to playback
self.ludioPlayer?.load(videoUrl: "https://mkplayer.z13.web.core.windows.net/squat.mp4")
// Call play
self.ludioPlayer?.play()
// Call pause when needed
self.ludioPlayer?.pause()
通过 LudioPlayerDelegate 监听事件
public protocol LudioPlayerDelegate: class {
func timeChanged(time: Double);
func rateChanged(rate: Double);
func stallStarted();
func stallEnded();
func onError(code: Number)
func onPlay();
func onPause();
}
self.ludioPlayer?.add(listener: self)
视频捕获
创建捕获对象并在视图中预览内容
// Create a Ludio Cpature object
self.ludioCapture = LudioCapture(view: self.camPreview!)
// Call start recording when you are ready
self.ludioCapture?.startRecording()
// Call stopRecording when you are done
ludioCapture?.stopRecording()
通过 LudioCpatureDelegate 监听事件
func onCaptureStarted()
func onCaptureCompleted()
func onError()