0

我正在尝试将从 Parse 检索到的视频放入 UIimage 中,我需要帮助。我将视频检索为 PFFile 。这是我的代码

 func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell :mineCell = tableView.dequeueReusableCellWithIdentifier("mineCell")as! mineCell

    cell.usernameLabel.text = creator[indexPath.row]

    videoFile[indexPath.row].getDataInBackgroundWithBlock { (videoData :NSData?, error:NSError?) -> Void in
        if videoData != nil{
        let video = UIImage(data: videoData!)
            cell.videoView.image = video
            println("it should the video load in the UImage ")
        }
        else {
            println(error)
        }
    }
    return cell
4

1 回答 1

0

问题是您不能将视频数据放入 UIImage。

您需要获取 UIImage 作为视频的缩略图,此处已回答

从那里,可以通过以下步骤完成从 PFFile 播放视频

// Load yourObject which has the video (PFFile)
var fileURL = NSURL(string: yourObject.video.url!)
var moviePlayer = MPMoviePlayerViewController(contentURL: fileURL)
self.presentMoviePlayerViewControllerAnimated(moviePlayer)
moviePlayer.moviePlayer.play()
于 2015-09-17T19:12:53.237 回答