im创建一个iOS应用程序,我必须在其中使用VLCPlayer播放360视频。我已经通过Pod添加了VLC,并在本地播放了360视频。但是VLC无法平移视频。 VLC不会将视频视为360视频。我应该进行许多设置以使用VLC播放360视频吗?
示例360视频URL https://drive.google.com/file/d/1TzoxrWMdiLBuf5TTq0v6lz-KNtxeMOb2/view
override func viewDidLoad() {
super.viewDidLoad()
guard let path = Bundle.main.path(forResource: "rico", ofType:"mov") else {
debugPrint("video.m4v not found")
return
}
mediaURL = path
setupMediaPLayer()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
mediaPlayer.play()
}
func setupMediaPLayer() {
mediaPlayer.delegate = self
mediaPlayer.drawable = movieView
mediaPlayer.media = VLCMedia(url: URL(fileURLWithPath: mediaURL!))
}
[您需要自己处理UIPinchGestureRecognizer
,才能处理360个视频。
- (void)handlePinchGesture:(UIPinchGestureRecognizer *)recognizer
{
CGFloat diff = DEFAULT_FOV * -(ZOOM_SENSITIVITY * recognizer.velocity / _screenPixelSize.width);
if ([_vpc currentMediaIs360Video]) {
[self zoom360Video:diff];
} else if (recognizer.velocity < 0. && _closeGestureEnabled) {
[self minimizePlayback:nil];
}
}