mardi 27 janvier 2015

speed playback for audio streaming in iOS using AVPlayer

I'm doing iOS Swift project and my only problem right now is about adjusting speed playback for audio streaming.


Here is what I've done.


I use AVPlayer for this project



streamingPlayer = AVPlayer(playerItem: audioItem)


To adjust speed



streamingPlayer.rate = slider.value


For the code above, I start to test with my test server which is a normal link to access the audio file directly and I found that there is no problem with adjusting speed rate. Every functions works fine.


I got problem when this project is required to use links which contain more security. To access the audio, it has to request through .ashx. Problem is the speed rate can be adjust to slower (AVPlayer rate < 1) but I speed rate can not be faster (Normal rate is 1, so problem is rate cannot be greater than 1)


I also tried to use the function below but it still didn't help.



audioItem.canPlayFastForward


Another weird problem is after it has been tested with many users, some users who has very high speed internet don't have problem with speed. I have tested on speed between 15 - 30 mbps and still got this problem. It's really confusing me. I assume it is problem about connection with server. But I don't want user to use a very high speed internet like that in order to use this app, what can I do?


Please help me if anyone know about this issue or have some recommendation. I have looked through the Document and tried almost every functions provided in AVPlayer; but it didn't help.


Here is the example link if you can help http://ift.tt/1zWpceN (This link will be expired soon)


Thank you


Aucun commentaire:

Enregistrer un commentaire