【问题标题】:retrieved videos as PFFile in Uiimage在 Uiimage 中将视频检索为 PFFile
【发布时间】:2015-09-17 10:56:27
【问题描述】:

我正在尝试将从 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

【问题讨论】:

  • 好。您有实际问题吗?
  • 感谢@planetmaker重播,实际问题是视频没有加载到uiimage中,有没有其他方法可以加载

标签: parse-platform uiimage pffile


【解决方案1】:

问题是您无法将视频数据放入 UIImage。

您需要获取 UIImage 作为视频的缩略图,which has already been answered here

从那里,可以通过以下步骤从 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-07-30
    • 2015-09-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多