Tau: Cannot play remote files on Android 9

Created on 3 Mar 2019  Â·  8Comments  Â·  Source: Canardoux/tau

Version of flutter_sound

v1.0.6

flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel unknown, v1.3.2, on Microsoft Windows [Version 10.0.17134.590], locale en-AT)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 3.3)
[√] Connected device (1 available)

• No issues found!

Platforms you faced the error (IOS or Android or both?)

Android - Samsung S8 - Android 9 Pie

Expected behavior

Can play remote files..

Actual behavior

Cannot play remote files.

Tested environment (Emulator? Real Device?)

Real device.

Steps to reproduce the behavior

Try to play any file from remote URL.

Log output:

I/MediaPlayer(26707): Need to enable context aware info
V/MediaPlayer-JNI(26707): native_setup
I/flutter (26707): error: Exception: Player already stopped.
V/MediaPlayerNative(26707): constructor
V/MediaPlayerNative(26707): setListener
V/MediaHTTPService(26707): MediaHTTPService(android.media.MediaHTTPService@b2558b2): Cookies: null
V/MediaPlayerNative(26707): setVideoSurfaceTexture
V/MediaPlayerNative(26707): prepare
V/MediaHTTPService(26707): makeHTTPConnection: CookieManager created: java.net.CookieManager@b993003
V/MediaHTTPService(26707): makeHTTPConnection(android.media.MediaHTTPService@b2558b2): cookieHandler: java.net.CookieManager@b993003 Cookies: null
D/MediaHTTPConnection(26707): setReadTimeOut = 15000ms
D/NetworkSecurityConfig(26707): Using Network Security Config from resource network_security_config debugBuild: true
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
D/MediaHTTPConnection(26707): setReadTimeout with 15000ms
I/System.out(26707): (HTTPLog)-Static: isSBSettingEnabled false
V/MediaPlayerNative(26707): message received msg=300, ext1=0, ext2=0
V/MediaPlayerNative(26707): Received SEC_MM_PLAYER_CONTEXT_AWARE
V/MediaPlayerNative(26707): callback application
V/MediaPlayerNative(26707): back from callback
V/MediaPlayerNative(26707): message received msg=100, ext1=1, ext2=-2147483648
E/MediaPlayerNative(26707): error (1, -2147483648)
V/MediaPlayerNative(26707): signal application thread
V/MediaPlayerNative(26707): prepare complete - status=1
E/FlutterSoundPlugin(26707): startPlayer() exception
E/flutter (26707): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: Exception: PlatformException(ERR_UNKNOWN, ERR_UNKNOWN, Prepare failed.: status=0x1)
E/flutter (26707): #0 FlutterSound.startPlayer (package:flutter_sound/flutter_sound.dart:163:7)
E/flutter (26707):

It worked fine on S8 with Android 8. Also it works now on other device with Android 8 without any problem.

Most helpful comment

Starting with Android 9.0 (API level 28), cleartext support is disabled by default.

Because of this, the MediaPlayer was not able to open the provided URL.

Options are to:

Solutions are explained here Android 8: Cleartext HTTP traffic not permitted

Without this change, the plugin is not able to play anything.

All 8 comments

Same behavior with flutter_sound v1.3.3 .

I don't have Android 9 device currently. Hope you can give us more information through stackoverflow.

Hi. Same is happening when you check it on the emulator.

emulator

Starting with Android 9.0 (API level 28), cleartext support is disabled by default.

Because of this, the MediaPlayer was not able to open the provided URL.

Options are to:

Solutions are explained here Android 8: Cleartext HTTP traffic not permitted

Without this change, the plugin is not able to play anything.

@bojanculafic Thanks for the explanation. Could you give us a PR own your finding?

Same here, even using cleartext traffic.

This issue is stale because it has been open 90 days with no activity. Leave a comment or this will be closed in 7 days.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Denmal1982 picture Denmal1982  Â·  4Comments

kiha-la picture kiha-la  Â·  5Comments

PabloduPontavice picture PabloduPontavice  Â·  3Comments

felixjunghans picture felixjunghans  Â·  4Comments

hanj315 picture hanj315  Â·  5Comments