Allow App Transport Security for radio streams with AVMediaPlayer

93 Views Asked by At

I'm currently working on a simple radio player app. Since the radio streams from the radio stations usually come via http, the App Transport Security does not allow this. I've already tried adding keys like Allows Arbitrary Loads for Media to the property list, the Transport Security app rejects the requests coming from the AVMediaPlayer. Is there a way at all, or do you have to release all Domins individually?

Here is my Property List:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoadsForMedia</key>
    <true/>
    <key>NSAllowsArbitraryLoadsForMediaUsageDescription</key>
    <dict>
        <key>NSATSExceptionServiceType</key>
        <dict>
            <key>NSThirdPartyMediaStreaming</key>
            <true/>
        </dict>
    </dict>
    <key>NSExceptionDomains</key>
    <dict/>

Here is the error message I get:

Task <2055AEDE-05A5-46FC-9B7B-926B6DD08F52>.<2> finished with error [-1022] Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." UserInfo={NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection., NSErrorFailingURLStringKey=http://sunshinelive.hoerradar.de/sunshinelive-live-mp3-hq, NSErrorFailingURLKey=http://sunshinelive.hoerradar.de/sunshinelive-live-mp3-hq, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <2055AEDE-05A5-46FC-9B7B-926B6DD08F52>.<2>" ), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <2055AEDE-05A5-46FC-9B7B-926B6DD08F52>.<2>, NSUnderlyingError=0x600003416e50 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "(null)"}}

0

There are 0 best solutions below