mojilala / YoutubeSourceParserKit

YouTube link parser for swift
MIT License
694 stars 110 forks source link

not working with AVPlayerViewController #14

Open holyman2k opened 8 years ago

holyman2k commented 8 years ago
let playerViewController:AVPlayerViewController = AVPlayerViewController()
    let youtubeUrl = NSURL(string: "https://www.youtube.com/watch?v=vXjVFPosQHw")!
    Youtube.h264videosWithYoutubeURL(youtubeUrl) { [unowned self] (videoInfo, error) -> Void in
        if let videoURLString = videoInfo?["url"] as? String,
            videoTitle = videoInfo?["title"] as? String {
                print("\(videoTitle)")
                print("\(videoURLString)")

                if let url = NSURL(string:videoURLString) {
                    let playerItem = AVPlayerItem(URL: url)
                    let player = AVPlayer(playerItem: playerItem)
                    self.playerViewController.player = player;
                    self.addChildViewController(self.playerViewController);
                    self.playerViewController.view.frame = self.view.frame;
                    self.view.addSubview(self.playerViewController.view);
                    player.play()
                }
        }
    }
}

When the AVPlayerViewController is added to the view, it show a video as unplayable

img

holyman2k commented 8 years ago

I think a few of the older video is not playable

sahin commented 8 years ago

@cemolcay @isair can you guys check it?

mobilityvalley commented 8 years ago

Hi,

I have the same issue on 80% on the links I tested. What's wrong ? is there a quick fix ?

Thanks

EdmundMai commented 8 years ago

Hi I have the same issue. Is there a fix?

mpc20001 commented 8 years ago

I know what the issue is. Ill see if i can make a pull request.

On Friday, May 27, 2016, Edmund notifications@github.com wrote:

Hi I have the same issue. Is there a fix?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/movielala/YoutubeSourceParserKit/issues/14#issuecomment-222182198, or mute the thread https://github.com/notifications/unsubscribe/ABVBERqyxT0a5IPEihkMqBF8T3FQPpT8ks5qFxIegaJpZM4HT7Oh .

mpc20001 commented 8 years ago

I'm not sure how to patch it in the code but I think the problem is it's pulling non mp4 links which the iphone can't use.

On Fri, May 27, 2016 at 8:49 AM, Joren Winge viperxj7@gmail.com wrote:

I know what the issue is. Ill see if i can make a pull request.

On Friday, May 27, 2016, Edmund notifications@github.com wrote:

Hi I have the same issue. Is there a fix?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/movielala/YoutubeSourceParserKit/issues/14#issuecomment-222182198, or mute the thread https://github.com/notifications/unsubscribe/ABVBERqyxT0a5IPEihkMqBF8T3FQPpT8ks5qFxIegaJpZM4HT7Oh .