You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
Thanks for such a library, i am using it in my apps.
In one of my apps i encountered a problem. I am getting a video from the phone's gallery, appending it on my lightbox array and trying to play it, but i am unsuccessful. If i add a remote video, it is playing the video. My own video url is something like this "assets-library://asset/asset.mov?id=C006BE3C-2327-4A91-A139-7B594A99458D&ext=mov".
thanks in advance.
Here is my code:
var controller:LightboxController! = nil
var lbImages = [LightboxImage]()
override func viewDidLoad() {
super.viewDidLoad()
LightboxConfig.handleVideo = { from, videoURL in
// Custom video handling
print("playing local :")
print(videoURL)
let videoController = AVPlayerViewController()
videoController.player = AVPlayer(url: videoURL)
from.present(videoController, animated: true) {
videoController.player?.play()
}
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
if let chosenImage = info[UIImagePickerControllerOriginalImage] as? UIImage {
picker.dismiss(animated: false, completion: { () -> Void in
print("width is " + String(describing: chosenImage.size.width) + " height " + String(describing: chosenImage.size.height))
self.lbImages.append(LightboxImage(image: chosenImage))
self.mediaCollectionView.reloadData()
})
} else if let videoURL = info["UIImagePickerControllerReferenceURL"] as? NSURL {
picker.dismiss(animated: false, completion: { () -> Void in
print(videoURL)
self.lbImages.append(LightboxImage(
image: UIImage(named:"news")!,
text: "",
videoURL: videoURL as URL
//videoURL: NSURL(string: "https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4") as URL?
))
self.mediaCollectionView.reloadData()
})
} else{
print("Something went wrong")
self.dismiss(animated: true, completion: nil)
}
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
controller = LightboxController(images: lbImages)
// Set delegates.
//controller.pageDelegate = self
//controller.dismissalDelegate = self
// Use dynamic background.
controller.dynamicBackground = true
// Present your controller.
controller.headerView.deleteButton.addTarget(self, action: #selector(self.deleteImage), for: .touchUpInside)
present(controller, animated: true, completion: nil)
}
The text was updated successfully, but these errors were encountered:
Hello,
Thanks for such a library, i am using it in my apps.
In one of my apps i encountered a problem. I am getting a video from the phone's gallery, appending it on my lightbox array and trying to play it, but i am unsuccessful. If i add a remote video, it is playing the video. My own video url is something like this "assets-library://asset/asset.mov?id=C006BE3C-2327-4A91-A139-7B594A99458D&ext=mov".
thanks in advance.
Here is my code:
The text was updated successfully, but these errors were encountered: