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

Need help setup Tack labels updating

tompointexe opened this issue · comments

Hi everyone , i'm having trouble setting up Track labels updating
i have the function
func radioPlayer(_ player: FRadioPlayer, metadataDidChange artistName: String?, trackName: String?) { }

But what to i put in there ?
i tried to follow exemples but not worked
Thanks for the help :)

Hi @TomAvecLeVdsl

You need to start by assigning your class or ViewController as delegate for FRadioPlayer.shared instance:

In viewDidLoad for example you can add:

FRadioPlayer.shared.delegate = self

Then you add this delegate function to your controller:

unc radioPlayer(_ player: FRadioPlayer, metadataDidChange artistName: String?, trackName: String?) {
    yourArtistNameLabel.text = artistName
    yourTrackNameLabel.text = trackName
 }

The function will be called automatically each time the stream metadata changes and update you UI accordingly.

Hi , all good , thanks for help :)
btw is it possible to get back the values when the view get's reloaded ? thanks

Hi, it's not possible for now to get the current artist and track name (it can be added in the future), but you can create your own class to track this information like the RadioPlayer wrapper class in the SwiftRadio project.

Ok , thanks a lot for the support :) have a great day :)

Np! You too :)