Closed MarkusWu closed 7 years ago
I am going to answer my own answer. At the time of writing this answer, XCDYouTubeVideoPlayerViewController does not support local video playing, but you can modify the code a little bit to make it work . In case anyone might be also interested in playing local video, here is the workaround.
Since XCDYouTubeVideoPlayerViewController is a subclass of MPMoviePlayerViewController, you can just use it as MPMoviePlayerViewController to play local video.
if (self.videoIdentifier == nil) {return;}
let fileUrl = //get the file url of the video you wanna play let player = XCDYouTubeVideoPlayerViewController()
videoIdentifier
is nil while playing local video. The default value is, nil.let player.videoIdentifier = nil
player.moviePlayer.contentURL = fileUrl player.moviePlayer.prepareToPlay()
Hi, I am trying to play a local video file with XCDYouTubeVideoPlayerViewController. Is it possible to play a local video, which is saved in the documentDirectory?