fethica / FRadioPlayer

A simple radio player framework for iOS, macOS, tvOS.

Home Page:https://fethica.github.io/FRadioPlayer/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Radio not playing ???

bhoomesh950 opened this issue · comments

`import UIKit
import AVFoundation
import FRadioPlayer

class RadioViewController: UIViewController {
let player = FRadioPlayer.shared

var audioPlayer: AVAudioPlayer?

override func viewDidLoad() {
    super.viewDidLoad()
    player.delegate = self

}


/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    // Get the new view controller using segue.destination.
    // Pass the selected object to the new view controller.
}
*/

@IBAction func playSongButtonPressed(_ sender: Any) {
    
    player.radioURL = URL(string: "http://rfcmedia.streamguys1.com/Newport.mp3")

    player.play()
}

}

extension RadioViewController: FRadioPlayerDelegate {

func radioPlayer(_ player: FRadioPlayer, playerStateDidChange state: FRadioPlayerState)
{
    print("radioPlayer");
}
func radioPlayer(_ player: FRadioPlayer, playbackStateDidChange state: FRadioPlaybackState)
{
    print("FRadioPlaybackState");
    
}
func radioPlayer(_ player: FRadioPlayer, itemDidChange url: URL?)
{
    print("itemDidChange");
    
}

func radioPlayer(_ player: FRadioPlayer, metadataDidChange artistName: String?, trackName: String?)
{
    print("metadataDidChange artistName");
    
}

func radioPlayer(_ player: FRadioPlayer, metadataDidChange rawValue: String?)
{
    print("metadataDidChange");
    
}

func radioPlayer(_ player: FRadioPlayer, artworkDidChange artworkURL: URL?)
{
    print("artworkDidChange");
    
}

// func radioPlayer(_ player: FRadioPlayer, artworkDidChange artworkURL: URL?) {
//
// // Please note that the following example is for demonstration purposes only, consider using asynchronous network calls to set the image from a URL.
// guard let artworkURL = artworkURL, let data = try? Data(contentsOf: artworkURL) else {
// artworkImageView.image = stations[selectedIndex].image
// return
// }
// track?.image = UIImage(data: data)
// artworkImageView.image = track?.image
// updateNowPlaying(with: track)
// }
}` please help me AVplayers showing nil values

It seems like you are using a none https link, did you set Allow Arbitrary Loads to YES in your Info.plist file?

screen shot 2018-12-24 at 8 33 18 pm

@fethica Thank you....