Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera Roll showing only images, not videos. #101

Open
Rashesh-Bosamiya opened this issue Oct 7, 2016 · 9 comments
Open

Camera Roll showing only images, not videos. #101

Rashesh-Bosamiya opened this issue Oct 7, 2016 · 9 comments

Comments

@Rashesh-Bosamiya
Copy link

Thank you for this wonderful library.

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

@s4cha
Copy link

s4cha commented Oct 20, 2016

That would be a Very useful addition :)

@michalciurus
Copy link

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(), {
....

@s4cha
Copy link

s4cha commented Oct 25, 2016

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

@brian-tran16
Copy link

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

@jaisan123
Copy link

jaisan123 commented Mar 27, 2017

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

@Pulichev
Copy link

  • 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
Copy link

Pulichev commented Jul 13, 2017

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.

@Vivekthakur647
Copy link

Vivekthakur647 commented Dec 6, 2017

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

        })

@dongmai
Copy link

dongmai commented Jan 11, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants