we ' reusingavplayeronios 8.4 toplayhls,AES-encrypted video。
our.m3 u8 filesincludetheurlofthelicenseserver,e.g.
EXT-X-KEY:METHOD=AES-128,URI='https://. '
In our iOS application,we're using atgdsl method
资源加载器: shouldwaitforloadingofrequestedresource 3360
tointercepttherequestthatgetssentbytheavplayer (orsomeobjectwithinavfoundation ) tothelicenseserver.withinthatmethod,weade
thelicenseserverreceivestherequestwiththetoken,returns the encryption key,and playback begins。
In other words,everything works as expected。
However,we ' re noticing (using the ' xld gtx ' http monitor ) )。 thatfollowingthecreationoftheavplayeritemandpriortotheinvocationoftheresourceloader 3360 method, avfoundationsendsaninitialrequest arequestthat ' snot ' routed ' throughmethodresourceloader 360.thisrequestisrejectedattttthesesed
Summary of events:
thisbehaviorcanbereplicatedusingapple ' savarldelegatedemoapp。
Questions:
istheinitialhttprequestsentbyavfoundationnormal?
If so,whyisitnecessaryandwhyisn ' tit getting ' routed ' throughtheresourceloader : method?
isitpossibletosuppresstheinitialrequestormodifyitbeforeit ' ssent?
汉克you!
解决方案
thesimpleanswertothisissueistheatgdslwillonlyhandlerequestsfor聪明的月亮swhichcannotbeprocessedinthenormalway。
In your case,the聪明之月for your key is a normal https://聪明之月,sotheavplayerwilltrytoprocessthisrequestitself.withoutthetokenthough, thisrequestisrejectedbyyourserver.therefore,theatgdslwillthenpasstherequesttoyourdelegatetohandleit。
To avoid the 'extraneous' request,modifyyourplaylistsothattheencryptionkey聪明月hasaninvalidscheme.usesomethinglikecrypt 3360 .
That way,youwillreceivetheresourceloadercallonthefirsttry,andyoucanreplacethecrypt ://scheme with 3359 anddyourtokenbbbry
It's just how atgdsl works,I'm afraid。
check out apple ' ssampleapphereformoredetails 3360
3359 developer.apple.com/library/IOs/sample code/sc 1791 /