Post

Replies

Boosts

Views

Activity

Reply to how to play a private video from AWS S3 using AVPlayer.
I got an error message like "NSURLConnection finished with error - code -1002". AVPlayer opens with blank screen. I have followed the below code to play the video from AWS S3    var avPlayerVC = AVPlayerViewController()   var playerView = AVPlayer()          func playFromS3(){     let getPreSignedURLRequest = AWSS3GetPreSignedURLRequest()     getPreSignedURLRequest.bucket = "elearningtestprep-userfiles-mobilehub-1056529852"     getPreSignedURLRequest.key = "public/teststats/satdemovideo/Of_Mice.mp4"     getPreSignedURLRequest.httpMethod = .GET     getPreSignedURLRequest.expires = Date(timeIntervalSinceNow: 3600)     AWSS3PreSignedURLBuilder.default().getPreSignedURL(getPreSignedURLRequest).continueWith { (task:AWSTaskNSURL) - Any? in       if let error = task.error {         print("AWSS3PreSignedURLBuilder Error: \(error)")         return nil       }               let presignedURL = task.result       let url:URL = URL(string : String(describing: presignedURL))!       self.playerView = AVPlayer(url: url)       self.avPlayerVC.player = self.playerView       DispatchQueue.main.async {         self.present(self.avPlayerVC, animated: true) {           self.avPlayerVC.player?.play()         }        }         return nil;     }   } using the above presignedURL, video is playing in browswer but not in app.
Feb ’21