XCDYouTubeKit icon indicating copy to clipboard operation
XCDYouTubeKit copied to clipboard

Audio play in background and play multiple sounds for multiple videos.

Open sAurangzaib opened this issue 6 years ago • 2 comments

I implement this @IBOutlet weak var ytPlayer: UIView!

func playYoutubeVideo() {
    let strUrl = youTubeObjc.link
    if let range = strUrl!.range(of: "=") {
        let strIdentifier = strUrl!.substring(from: range.upperBound)
        print("Identifier:\(strIdentifier)")
        let videoPlayerViewController =
            XCDYouTubeVideoPlayerViewController(videoIdentifier: strIdentifier)
        videoPlayerViewController.present(in: ytPlayer)

// videoPlayerViewController.moviePlayer.play() videoPlayerViewController.moviePlayer.shouldAutoplay = false videoPlayerViewController.moviePlayer.prepareToPlay() } } i try to stop it but failed.

sAurangzaib avatar Feb 15 '19 15:02 sAurangzaib

The demo app doesn't seem to be playing audio in the background by default when the app goes to the background or the phone is locked. Does something else have to be set somewhere?

mobile-appz avatar May 10 '20 12:05 mobile-appz

The demo app doesn't seem to be playing audio in the background by default when the app goes to the background or the phone is locked. Does something else have to be set somewhere?

Have just found the solution to play audio in the background is to tap on the settings icon in the top right corner of the demo app, and change Audio Session category to Playback.

mobile-appz avatar May 10 '20 15:05 mobile-appz