Fusuma
Fusuma copied to clipboard
Camera Roll showing only images, not videos.
Thank you for this wonderful library.
I want to show images as well as videos in camera roll view.
That would be a Very useful addition :)
It's literally a couple of lines to add support for videos! I just did it today, but I won't do a PR, because I'm working on the swift2.3
branch and I have a lot of my own changes.
just change the line in FSAlbumView
to load photos + video (not only photos).
images = PHAsset.fetchAssetsWithOptions(options)
and in doneButtonPressed
in Fusuma VC:
if asset.mediaType == .Video {
PHImageManager.defaultManager().requestAVAssetForVideo(self.albumView.phAsset, options: nil, resultHandler: { (video, audioMix, info) in
dispatch_async(dispatch_get_main_queue(), {
let urlAsset = video as! AVURLAsset
self.delegate?.fusumaVideoCompleted(withFileURL: urlAsset.URL)
self.dismissViewControllerAnimated(true, completion: {
})
})
})
} else {
PHImageManager.defaultManager().requestImageForAsset(self.albumView.phAsset, targetSize: targetSize,
contentMode: .AspectFill, options: options) {
result, info in
dispatch_async(dispatch_get_main_queue(), {
....
@michalciurus Thanks you so much for putting us on the right track , much appreciated :)
let fusuma = FusumaViewController() fusuma.delegate = self fusuma.hasVideo = false
im new to this language.i tried my best to add video in the collection view.but getting an image of that video only(without any indication of a video file).how to add a video label with its duration on it..please help me with the doneButtonPressed function too.i need to pass the video to next page..please please help me with this
- to jaisan123. Should we add it yourself? Like .addSublayer on Asset? with little "play" button to indicate, that it is video. Or Fusuma already has some extensions for this one? Thanks to @michalciurus actually for helping with adding video to roll. And also thanks for this library! Its pretty interesting
founded this fork. But, when selecting video from album it is showing like a picture:( But still has video duration on asset, photo filters etc.
https://github.com/Yummypets/YPImagePicker
My suggestion is to install through carthage. And also 'import YPImagePicker' instead of Fusuma. If this is bad post, I'm sorry.
I am trying my best to fetch and play video before done button action . Exactly like instagram. but i am stuck now please help me. My error is as "FSAlbumView" is so how can present my AVPlayerviewcontroller and play video automatically like instagram. // Checxk out my code if asset.mediaType.rawValue==2 { // For Video PHImageManager.default().requestAVAsset(forVideo: asset, options: nil, resultHandler: { (video, audioMix, info) in
let urlAsset = video as! AVURLAsset
print(urlAsset)
var StaticURLForNow = URL.init(string: "http://techslides.com/demos/sample-videos/small.mp4")
let player = AVPlayer(url: StaticURLForNow!)
let playerViewController = AVPlayerViewController()
playerViewController.player = player
// HERE I GOT ERROR like : Value of type 'FSAlbumView' has no member 'present' self.present(playerViewController, animated: true) { playerViewController.player!.play() }
})
https://github.com/Yummypets/YPImagePicker is the best option I think :), thank @Pulichev