Fusuma icon indicating copy to clipboard operation
Fusuma copied to clipboard

Camera Roll showing only images, not videos.

Open Rashesh-Bosamiya opened this issue 7 years ago • 9 comments

Thank you for this wonderful library.

I want to show images as well as videos in camera roll view.

Rashesh-Bosamiya avatar Oct 07 '16 10:10 Rashesh-Bosamiya

That would be a Very useful addition :)

s4cha avatar Oct 20 '16 15:10 s4cha

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 avatar Oct 22 '16 20:10 michalciurus

@michalciurus Thanks you so much for putting us on the right track , much appreciated :)

s4cha avatar Oct 25 '16 08:10 s4cha

let fusuma = FusumaViewController() fusuma.delegate = self fusuma.hasVideo = false

brian-tran16 avatar Jan 19 '17 03:01 brian-tran16

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

jaisan123 avatar Mar 27 '17 06:03 jaisan123

  • 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

Pulichev avatar Apr 27 '17 09:04 Pulichev

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.

Pulichev avatar Jul 13 '17 05:07 Pulichev

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() }

        })

Vivekthakur647 avatar Dec 06 '17 07:12 Vivekthakur647

https://github.com/Yummypets/YPImagePicker is the best option I think :), thank @Pulichev

dongmai avatar Jan 11 '18 16:01 dongmai