Dalal Alharbi
Dalal Alharbi

Reputation: 191

how can any iOS application download video from parse? with swift

I do upload to video with this code (parse.com)

func imagePickerController(picker: UIImagePickerController,    didFinishPickingMediaWithInfo info: [String : AnyObject]) {
    urlVideo = info[UIImagePickerControllerMediaURL] as! NSURL
     courseVideo=NSData (contentsOfURL: urlVideo)!

    self.dismissViewControllerAnimated(true, completion: nil)
    objMoviePlayerController = MPMoviePlayerController(contentURL: urlVideo)
    objMoviePlayerController.movieSourceType = MPMovieSourceType.Unknown
    objMoviePlayerController.view.frame = self.videoView.bounds
    objMoviePlayerController.scalingMode = MPMovieScalingMode.AspectFill
    objMoviePlayerController.controlStyle = MPMovieControlStyle.Embedded
    objMoviePlayerController.shouldAutoplay = true
    videoView.addSubview(objMoviePlayerController.view)
    objMoviePlayerController.prepareToPlay()
    objMoviePlayerController.play()
}

But I see black view like this

screen-capture

In this line

    print(self.urlFromParse!)

I have url of text file

What is wrong?

Upvotes: 1

Views: 303

Answers (1)

Henry Situ
Henry Situ

Reputation: 153

Rename the video with an filename extension like .mov

I clicked on your link and it downloaded https://files.parsetfss.com/82cab6fb-bf11-41ff-9a92-7f29bc217cbf/tfss-796481df-c791-4240-be1b-b4e8a69ddca0-video on to my computer but when I try to open it, it opens as a text file, so if you add .mov to the end of this file when the file is uploaded, that will work for you.

Upvotes: 1

Related Questions