iphone - iOS stream audio from authenticated URL -


i want stream audio file source needs oauth2 authentication, code, not working.

nsmutableurlrequest *req = [nsmutableurlrequest requestwithurl:url];          [req setvalue:[nsstring stringwithformat:@"bearer %@", accesstoken] forhttpheaderfield:@"authorization"];          player = [avplayer playerwithurl:req.url];         [player play]; 

can please help?

the issue you're adding authentication token http header, making request using url (and headers not included in url).

i need similar thing in app, doesn't it's possible interfere avplayer's network request (at least, not public api). i'm looking @ either requesting file myself using nsurlsession (which means no streaming - gotta wait whole file, or else complicated processing hand off audio player in chunks), or else fudge web service accept parameter query parameter instead of http header.

this question has potential work-arounds: send headers avplayer request in ios


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -