I thought that I can check the status of AVPlayer simply by the "rate" property.
This is how I create a player instance:
player = AVPlayer(URL: stream)
At some later point I would do something like this
println(player!.rate)
Here is what I discovered:
- In Simulator, I get β0.0β if the player is down or β1.0β if it is running.
- If I start the player, but interrupted the Internet connection, it will change the values ββfrom 1 to 0.
- However, on my iPhone, the property retains the value 1, even if I enter airplane mode ?!
Do you have an idea why this is happening and how can I check the flow condition otherwise?
I have already tried an observer:
player!.addObserver(self, forKeyPath: "status", options: NSKeyValueObservingOptions.New, context: nil)
But even the "observValueForKeyPath" method does not start in my iPhone test case.
source share