Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell
- {
- var videoCell = collectionView.dequeueReusableCellWithReuseIdentifier("cellVideo", forIndexPath: indexPath) as? CollectionViewCell
- let post = self.arrayOfDetails[indexPath.row]
- var myUrl = post.image // post.image is image url
- let fileUrl = NSURL(string: post.image)
- aPlayer = AVPlayer(URL: fileUrl)
- moviePlayerController.player = aPlayer
- moviePlayerController.view.frame = CGRectMake(8, 8, videoCell!.frame.size.width-16, 310)
- moviePlayerController.videoGravity = AVLayerVideoGravityResizeAspectFill
- moviePlayerController.view.sizeToFit()
- moviePlayerController.showsPlaybackControls = true
- videoCell!.addSubview(moviePlayerController.view)
- return videoCell!
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement