player icon indicating copy to clipboard operation
player copied to clipboard

disable ssl certificate validation when playing audio?

Open warpdesign opened this issue 3 years ago • 2 comments

I have Koel running on my local network. I have enabled ssl, but since it's only for my local network, I have self issued a certificate (which cannot be verified by the browser).

The app is running, but whenever I try to play a song, I get this error:

[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: Null check operator used on a null value #0 AudioProvider.init. (package:app/providers/audio_provider.dart:37:40) #1 _rootRunUnary (dart:async/zone.dart:1436:47) #2 _CustomZone.runUnary (dart:async/zone.dart:1335:19) #3 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7) #4 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11) #5 _DelayedData.perform (dart:async/stream_impl.dart:591:14) #6 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:706:11) #7 _PendingEvents.schedule. (dart:async/stream_impl.dart:663:7) #8 _rootRun (dart:async/zone.dart:1420:47) #9 _CustomZone.run (dart:async/zone.dart:1328:19) #10 _CustomZone.runGuarded (dart:async/zone.dart:1236:7) #11 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1276:23) #12 _rootRun (dart:async/zone.dart:1428:13) #13 _CustomZone.run (dar<…> flutter: PlatformException(PLAY_ERROR, Cannot play https://zique.fr.local/play/30e58cc455e7d4f55c2bda3573123937?api_token=9%7CwQ8EfNXK93ZTPyvLBcZ2qStLH23MYa04jeM2zukA, The certificate for this server is invalid., null)

Is there a way to disable certificate validation when playing audio?

I tried to add these keys in Info.plist, which made the app running, but seem to have no impact on audio playback restrictions:

        <key>NSAllowsArbitraryLoads</key>
        <true/>
        <key>NSAllowsArbitraryLoadsForMedia</key>
        <true/>
        <key>NSAllowsArbitraryLoadsInWebContent</key>
        <true/>
        <key>NSAllowsLocalNetworking</key>
        <true/>

warpdesign avatar Jan 21 '22 10:01 warpdesign

Finally I added this and am using no http, not https:

        <key>NSAppTransportSecurity</key>
        <dict>
                <key>NSAllowsArbitraryLoads</key>
                <true/>
        </dict>

Now I get no error but I still cannot hear any song (and nothing happens when taping a sound: I see no playback controls appearing,..).

warpdesign avatar Jan 21 '22 11:01 warpdesign

After some thoughts, I tried pointing the app to the Koel demo server: demo.koel.dev and playback doesn't work either.

I get the following error:

flutter: error caught: PlatformException(PLAY_ERROR, Cannot play https://demo.koel.dev/play/312efc46c3ef5a09f625870d83321f11?api_token=15291%7Cxhze0T1EGKeRaUHBMQZ3JBMSohoBYPVV0OOYjDPG, unknown error, null)
[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: Null check operator used on a null value
#0      AudioProvider.init.<anonymous closure> (package:app/providers/audio_provider.dart:37:40)
#1      _rootRunUnary (dart:async/zone.dart:1436:47)
#2      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
#3      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
#4      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#5      _DelayedData.perform (dart:async/stream_impl.dart:591:14)
#6      _StreamImplEvents.handleNext (dart:async/stream_impl.dart:706:11)
#7      _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:663:7)
#8      _rootRun (dart:async/zone.dart:1420:47)
#9      _CustomZone.run (dart:async/zone.dart:1328:19)
#10     _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
#11     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276:23)
#12     _rootRun (dart:async/zone.dart:1428:13)
#13     _CustomZone.run (dar<…>
flutter: PlatformException(PLAY_ERROR, Cannot play https://demo.koel.dev/play/312efc46c3ef5a09f625870d83321f11?api_token=15291%7Cxhze0T1EGKeRaUHBMQZ3JBMSohoBYPVV0OOYjDPG, unknown error, null)
flutter: error caught: PlatformException(PLAY_ERROR, Cannot play https://demo.koel.dev/play/312efc46c3ef5a09f625870d83321f11?api_token=15291%7Cxhze0T1EGKeRaUHBMQZ3JBMSohoBYPVV0OOYjDPG, unknown error, null)

(I checked out the latest version from git: 28ceb01e443df095d6d529921a8da60d6afa1da1

warpdesign avatar Jan 21 '22 11:01 warpdesign