Describe the bug
No audio for YouTube video. It looks like the key line in the console output is "Requires MODIFY_AUDIO_SETTINGS and RECORD_AUDIO. No audio device will be available for recording" (full output below). The video plays fine, it's just the sound that is an issue.
To Reproduce
Code:
class TestYoutube extends StatelessWidget {
final YoutubePlayerController _controller = YoutubePlayerController(
initialVideoId: '#Secret',
flags: YoutubePlayerFlags(
autoPlay: true,
mute: true,
),
);
@override
Widget build(BuildContext context) {
return YoutubePlayer(
controller: _controller,
showVideoProgressIndicator: true,
progressIndicatorColor: Colors.amber,
progressColors: ProgressBarColors(
playedColor: Colors.amber,
handleColor: Colors.amberAccent,
),
);
}
}
Expected behavior
I expect the video to play with sound.
Technical Details:
Additional context
I've found https://stackoverflow.com/questions/38917751/webview-webrtc-not-working which suggests adding some permissions to the Android side of things. I tried this, but it didn't help with the bug (though it did remove the warning from the console). Also the README for this package says "No configuration required - the plugin should work out of the box." for Android configuration.
The full console log is:
E/InputMethodManager( 2871): b/117267690: Failed to get fallback IMM with expected displayId=7 actual IMM#displayId=0 view=io.flutter.plugins.webviewflutter.InputAwareWebView{2264b7f VFEDHVC.. ........ 0,0-1080,2076}
W/libEGL ( 2871): EGLNativeWindowType 0x70e27afd10 disconnect failed
D/ViewRootImpl@2bb0f67[MainActivity]( 2871): dispatchDetachedFromWindow
D/InputTransport( 2871): Input channel destroyed: '4340e9d', fd=117
E/chromium( 2871): [ERROR:aw_browser_terminator.cc(125)] Renderer process (3271) crash detected (code -1).
Restarted application in 2,435ms.
D/SurfaceView( 2871): onWindowVisibilityChanged(4) false io.flutter.embedding.android.FlutterSurfaceView{716dede V.E...... ........ 0,0-1080,2076} of ViewRootImpl@bf3b960[MainActivity]
D/ViewRootImpl@bf3b960[MainActivity]( 2871): Relayout returned: old=(0,0,1080,2220) new=(0,0,1080,2220) req=(1080,2220)4 dur=11 res=0x1 s={false 0} ch=false
D/ViewRootImpl@bf3b960[MainActivity]( 2871): stopped(false) old=true
D/SurfaceView( 2871): windowStopped(false) false io.flutter.embedding.android.FlutterSurfaceView{716dede V.E...... ........ 0,0-1080,2076} of ViewRootImpl@bf3b960[MainActivity]
D/ViewRootImpl@bf3b960[MainActivity]( 2871): stopped(false) old=false
D/SurfaceView( 2871): onWindowVisibilityChanged(0) true io.flutter.embedding.android.FlutterSurfaceView{716dede V.E...... ........ 0,0-1080,2076} of ViewRootImpl@bf3b960[MainActivity]
D/ViewRootImpl@bf3b960[MainActivity]( 2871): Relayout returned: old=(0,0,1080,2220) new=(0,0,1080,2220) req=(1080,2220)0 dur=6 res=0x7 s={true 479595032576} ch=true
D/OpenGLRenderer( 2871): createReliableSurface : 0x70e27afd00, 0x6faa177000
D/mali_winsys( 2871): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
D/SurfaceView( 2871): surfaceCreated 1 #8 io.flutter.embedding.android.FlutterSurfaceView{716dede V.E...... ........ 0,0-1080,2076}
D/mali_winsys( 2871): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
D/SurfaceView( 2871): surfaceChanged (1080,2076) 1 #8 io.flutter.embedding.android.FlutterSurfaceView{716dede V.E...... ........ 0,0-1080,2076}
D/Dialog ( 2871): mIsSamsungBasicInteraction = false
D/Dialog ( 2871): mIsSamsungBasicInteraction = false, isMetaDataInActivity = false
I/MultiWindowDecorSupport( 2871): updateCaptionType >> DecorView@e4e905d[], isFloating: false, isApplication: false, hasWindowDecorCaption: false, hasWindowControllerCallback: false
D/MultiWindowDecorSupport( 2871): setCaptionType = 0, DecorView = DecorView@e4e905d[]
D/ViewRootImpl@68521ff[MainActivity]( 2871): setView = com.android.internal.policy.DecorView@e4e905d TM=true MM=false
D/ViewRootImpl@bf3b960[MainActivity]( 2871): MSG_WINDOW_FOCUS_CHANGED 1 1
D/InputMethodManager( 2871): prepareNavigationBarInfo() DecorView@2d771f4[MainActivity]
D/InputMethodManager( 2871): getNavigationBarColor() -855310
D/InputMethodManager( 2871): prepareNavigationBarInfo() DecorView@2d771f4[MainActivity]
D/InputMethodManager( 2871): getNavigationBarColor() -855310
V/InputMethodManager( 2871): Starting input: tba=com.example.BethshanConnect ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
D/InputMethodManager( 2871): startInputInner - Id : 0
I/InputMethodManager( 2871): startInputInner - mService.startInputOrWindowGainedFocus
V/InputMethodManager( 2871): Not IME target window, ignoring
D/ViewRootImpl@68521ff[MainActivity]( 2871): Relayout returned: old=(0,0,1080,2076) new=(0,0,1080,2076) req=(1080,2076)0 dur=10 res=0x7 s={true 479593013248} ch=true
D/OpenGLRenderer( 2871): createReliableSurface : 0x6fbdb3b880, 0x6fa9f8a000
D/mali_winsys( 2871): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
E/DecorView( 2871): mWindow.mActivityCurrentConfig is null
D/ViewRootImpl@68521ff[MainActivity]( 2871): MSG_RESIZED_REPORT: frame=(0,0,1080,2076) ci=(0,0,0,0) vi=(0,0,0,0) or=1
I/chromium( 2871): [INFO:CONSOLE(388)] "Unrecognized feature: 'picture-in-picture'.", source: https://s.ytimg.com/yts/jsbin/www-widgetapi-vflXhArfp/www-widgetapi.js (388)
D/SensorManager( 2871): registerListener :: 20, Samsung Game Rotation Vector, 16666, 0,
D/SensorManager( 2871): unregisterListener :: 20, Samsung Game Rotation Vector,
I/cr_MediaCodecBridge( 2871): create MediaCodec video decoder, mime video/avc
D/ ( 2871): PlayerBase::PlayerBase()
D/ ( 2871): TrackPlayerBase::TrackPlayerBase()
I/libOpenSLES( 2871): Emulating old channel mask behavior (ignoring positional mask 0x3, using default mask 0x3 based on channel count of 2)
I/ACodec ( 2871): [] Now uninitialized
I/ACodec ( 2871): [] onAllocateComponent
I/OMXClient( 2871): IOmx service obtained
I/ACodec ( 2871): [OMX.Exynos.avc.dec] Now Loaded
I/MediaCodec( 2871): MediaCodec will operate in async mode
D/SurfaceUtils( 2871): connecting to surface 0x6f5b067010, reason connectToSurface
I/MediaCodec( 2871): [OMX.Exynos.avc.dec] setting surface generation to 2939908
D/SurfaceUtils( 2871): disconnecting from surface 0x6f5b067010, reason connectToSurface(reconnect)
D/SurfaceUtils( 2871): connecting to surface 0x6f5b067010, reason connectToSurface(reconnect)
I/ACodec ( 2871): app-pid(2871)
D/DirectStreamingProxy( 2871): uid = 10183
I/ACodec ( 2871): can't find wfdsink-exynos-enable
I/SmartFittingClass( 2871): Create SmartFitting Version 2.0
I/SmartFittingClass( 2871): Init, [State:UNINITIALIZED] pid: 2871
I/ACodec ( 2871): [OMX.Exynos.avc.dec] Now Loaded->Idle
I/SmartFittingClass( 2871): InitialCheck()
I/SmartFittingClass( 2871): Create SmartFittingManagerServiceProxy!!
I/SmartFittingClass( 2871): SmartFittingManagerServiceProxy::init
I/SmartFittingClass( 2871): Create SmartFittingManagerServiceProxy::EventHandler
I/SmartFittingClass( 2871): SmartFittingManagerServiceProxy::onAddSmartFittingListener pid: 2871
I/SmartFittingClass( 2871): Create SmartFittingListener
D/SurfaceUtils( 2871): set up nativeWindow 0x6f5b067010 for 854x480, color 0x105, rotation 0, usage 0x602900
I/ACodec ( 2871): [OMX.Exynos.avc.dec] configureOutputBuffersFromNativeWindow setBufferCount : 10, minUndequeuedBuffers : 6
I/ACodec ( 2871): [OMX.Exynos.avc.dec] Now Idle->Executing
I/ACodec ( 2871): [OMX.Exynos.avc.dec] Now Executing
I/MediaCodec( 2871): setCodecState state : 0
W/MapperHal( 2871): buffer descriptor with invalid usage bits 0x200000
W/MapperHal( 2871): buffer descriptor with invalid usage bits 0x200000
I/ACodec ( 2871): [OMX.Exynos.avc.dec] Now handling output port settings change
W/AHierarchicalStateMachine( 2871): Warning message AMessage(what = 'omxI') = {
W/AHierarchicalStateMachine( 2871): int32_t type = 0
W/AHierarchicalStateMachine( 2871): int32_t event = 3
W/AHierarchicalStateMachine( 2871): int32_t data1 = 1
W/AHierarchicalStateMachine( 2871): int32_t data2 = 117440527
W/AHierarchicalStateMachine( 2871): } unhandled in root state.
D/SurfaceUtils( 2871): set up nativeWindow 0x6f5b067010 for 864x480, color 0x105, rotation 0, usage 0x602900
I/ACodec ( 2871): [OMX.Exynos.avc.dec] configureOutputBuffersFromNativeWindow setBufferCount : 14, minUndequeuedBuffers : 6
W/MapperHal( 2871): buffer descriptor with invalid usage bits 0x200000
I/chatty ( 2871): uid=10183(com.example.BethshanConnect) CodecLooper identical 3 lines
W/MapperHal( 2871): buffer descriptor with invalid usage bits 0x200000
I/ACodec ( 2871): [OMX.Exynos.avc.dec] Now Executing
I/ACodec ( 2871): [OMX.Exynos.avc.dec] OMX_EventPortSettingsChanged 0x7f030010
W/MapperHal( 2871): buffer descriptor with invalid usage bits 0x200000
W/MapperHal( 2871): buffer descriptor with invalid usage bits 0x200000
W/MapperHal( 2871): buffer descriptor with invalid usage bits 0x200000
D/ViewRootImpl@68521ff[MainActivity]( 2871): Relayout returned: old=(0,0,1080,2076) new=(0,0,1080,2076) req=(1080,2076)0 dur=5 res=0x1 s={true 479593013248} ch=false
I/MediaCodec( 2871): setCodecState state : 1
W/MapperHal( 2871): buffer descriptor with invalid usage bits 0x200000
D/NdkImageReader( 2871): acquireImageLocked: Overriding buffer format YUV_420_888 to 0x105.
W/MapperHal( 2871): buffer descriptor with invalid usage bits 0x200000
I/SmartFittingClass( 2871): InitialCheck, WhiteListStatus returned from CodecSolution : 0
I/SmartFittingClass( 2871): InitialCheck, [State:FINISHED] SmartFitting has not been activated by App. Shut Down SmartFitting.
E/chromium( 2871): [ERROR:web_contents_delegate.cc(218)] WebContentsDelegate::CheckMediaAccessPermission: Not supported.
E/chromium( 2871): [ERROR:web_contents_delegate.cc(218)] WebContentsDelegate::CheckMediaAccessPermission: Not supported.
W/cr_media( 2871): Requires MODIFY_AUDIO_SETTINGS and RECORD_AUDIO. No audio device will be available for recording
D/ViewRootImpl@bf3b960[MainActivity]( 2871): ViewPostIme pointer 0
D/ViewRootImpl@bf3b960[MainActivity]( 2871): ViewPostIme pointer 1
D/ViewRootImpl@bf3b960[MainActivity]( 2871): ViewPostIme pointer 0
D/ViewRootImpl@bf3b960[MainActivity]( 2871): ViewPostIme pointer 1
D/ViewRootImpl@bf3b960[MainActivity]( 2871): ViewPostIme pointer 0
D/ViewRootImpl@bf3b960[MainActivity]( 2871): ViewPostIme pointer 1
D/ViewRootImpl@bf3b960[MainActivity]( 2871): ViewPostIme pointer 0
D/ViewRootImpl@bf3b960[MainActivity]( 2871): ViewPostIme pointer 1
I/ACodec ( 2871): [OMX.Exynos.avc.dec] signalFlush
I/ACodec ( 2871): [OMX.Exynos.avc.dec] ExecutingState flushing now (codec owns 0/5 input, 8/14 output).
I/ACodec ( 2871): [OMX.Exynos.avc.dec] Now Flushing
I/ACodec ( 2871): [OMX.Exynos.avc.dec] FlushingState onOMXEvent(0,1,0)
I/ACodec ( 2871): [OMX.Exynos.avc.dec] FlushingState onOMXEvent(0,1,1)
I/ACodec ( 2871): [OMX.Exynos.avc.dec] Now Executing
D/ViewRootImpl@bf3b960[MainActivity]( 2871): ViewPostIme pointer 0
D/ViewRootImpl@bf3b960[MainActivity]( 2871): ViewPostIme pointer 1
D/ViewRootImpl@bf3b960[MainActivity]( 2871): ViewPostIme pointer 0
D/ViewRootImpl@bf3b960[MainActivity]( 2871): ViewPostIme pointer 1
D/ViewRootImpl@68521ff[MainActivity]( 2871): Relayout returned: old=(0,0,1080,2076) new=(0,0,1080,2076) req=(1080,2076)0 dur=8 res=0x1 s={true 479593013248} ch=false
I/MediaCodec( 2871): setCodecState state : 0
E/InputMethodManager( 2871): b/117267690: Failed to get fallback IMM with expected displayId=8 actual IMM#displayId=0 view=io.flutter.plugins.webviewflutter.InputAwareWebView{4c0ca83 VFEDHVC.. ........ 0,0-1080,2076}
Reloaded 2 of 539 libraries in 779ms.
D/Dialog ( 2871): mIsSamsungBasicInteraction = false
D/Dialog ( 2871): mIsSamsungBasicInteraction = false, isMetaDataInActivity = false
I/MultiWindowDecorSupport( 2871): updateCaptionType >> DecorView@d248f2e[], isFloating: false, isApplication: false, hasWindowDecorCaption: false, hasWindowControllerCallback: false
D/MultiWindowDecorSupport( 2871): setCaptionType = 0, DecorView = DecorView@d248f2e[]
D/ViewRootImpl@cdf0248[MainActivity]( 2871): setView = com.android.internal.policy.DecorView@d248f2e TM=true MM=false
I/MediaCodec( 2871): setCodecState state : 1
W/chromium( 2871): [WARNING:sync_reader.cc(170)] ASR: No room in socket buffer.: Broken pipe (32)
D/ ( 2871): PlayerBase::stop() from IPlayer
D/AudioTrack( 2871): stop(1340): called with 885862 frames delivered
E/DecorView( 2871): mWindow.mActivityCurrentConfig is null
V/InputMethodManager( 2871): Not IME target window, ignoring
W/cr_MediaCodecBridge( 2871): Releasing: OMX.Exynos.avc.dec
I/ACodec ( 2871): [OMX.Exynos.avc.dec] Now Executing->Idle
D/ViewRootImpl@cdf0248[MainActivity]( 2871): Relayout returned: old=(0,0,1080,2076) new=(0,0,1080,2076) req=(1080,2076)0 dur=7 res=0x7 s={true 479921696768} ch=true
D/OpenGLRenderer( 2871): createReliableSurface : 0x6fc47d7700, 0x6fbd8ff000
D/mali_winsys( 2871): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
I/ACodec ( 2871): [OMX.Exynos.avc.dec] Now Idle->Loaded
I/ACodec ( 2871): [OMX.Exynos.avc.dec] Now Loaded
I/SmartFittingClass( 2871): ShutDownSmartFitting!!
I/SmartFittingClass( 2871): SmartFittingManagerServiceProxy::Deinit
I/SmartFittingClass( 2871): Destroy SmartFittingListener
I/SmartFittingClass( 2871): Destroy ~SmartFittingManagerServiceProxy::EventHandler
I/SmartFittingClass( 2871): Destroy SmartFitting!!
I/SmartFittingClass( 2871): Destroy SmartFittingManagerServiceProxy!!
I/ACodec ( 2871): [OMX.Exynos.avc.dec] Now uninitialized
I/ACodec ( 2871): [] Now kWhatShutdownCompleted event : 8503
D/SurfaceUtils( 2871): disconnecting from surface 0x6f5b067010, reason disconnectFromSurface
E/DecorView( 2871): mWindow.mActivityCurrentConfig is null
I/MediaCodec( 2871): Codec shutdown complete
W/cr_MediaCodecBridge( 2871): Codec released
W/libEGL ( 2871): EGLNativeWindowType 0x6fbdb3b890 disconnect failed
D/ViewRootImpl@68521ff[MainActivity]( 2871): dispatchDetachedFromWindow
D/InputTransport( 2871): Input channel destroyed: 'edf1f60', fd=191
D/ViewRootImpl@cdf0248[MainActivity]( 2871): MSG_RESIZED: frame=(0,0,1080,2076) ci=(0,0,0,0) vi=(0,0,0,0) or=1
I/cr_MediaCodecBridge( 2871): create MediaCodec video decoder, mime video/avc
I/ACodec ( 2871): [] Now uninitialized
I/ACodec ( 2871): [] onAllocateComponent
I/OMXClient( 2871): IOmx service obtained
I/ACodec ( 2871): [OMX.Exynos.avc.dec] Now Loaded
I/MediaCodec( 2871): MediaCodec will operate in async mode
D/SurfaceUtils( 2871): connecting to surface 0x6fc70df010, reason connectToSurface
I/MediaCodec( 2871): [OMX.Exynos.avc.dec] setting surface generation to 2939909
D/SurfaceUtils( 2871): disconnecting from surface 0x6fc70df010, reason connectToSurface(reconnect)
D/SurfaceUtils( 2871): connecting to surface 0x6fc70df010, reason connectToSurface(reconnect)
I/ACodec ( 2871): app-pid(2871)
D/DirectStreamingProxy( 2871): uid = 10183
I/ACodec ( 2871): can't find wfdsink-exynos-enable
I/SmartFittingClass( 2871): Create SmartFitting Version 2.0
I/SmartFittingClass( 2871): Init, [State:UNINITIALIZED] pid: 2871
I/ACodec ( 2871): [OMX.Exynos.avc.dec] Now Loaded->Idle
I/SmartFittingClass( 2871): InitialCheck()
I/SmartFittingClass( 2871): Create SmartFittingManagerServiceProxy!!
I/SmartFittingClass( 2871): SmartFittingManagerServiceProxy::init
I/SmartFittingClass( 2871): Create SmartFittingManagerServiceProxy::EventHandler
I/SmartFittingClass( 2871): SmartFittingManagerServiceProxy::onAddSmartFittingListener pid: 2871
I/SmartFittingClass( 2871): Create SmartFittingListener
D/SurfaceUtils( 2871): set up nativeWindow 0x6fc70df010 for 854x480, color 0x105, rotation 0, usage 0x602900
I/ACodec ( 2871): [OMX.Exynos.avc.dec] configureOutputBuffersFromNativeWindow setBufferCount : 10, minUndequeuedBuffers : 6
I/ACodec ( 2871): [OMX.Exynos.avc.dec] Now Idle->Executing
I/MediaCodec( 2871): setCodecState state : 0
I/ACodec ( 2871): [OMX.Exynos.avc.dec] Now Executing
W/MapperHal( 2871): buffer descriptor with invalid usage bits 0x200000
W/MapperHal( 2871): buffer descriptor with invalid usage bits 0x200000
I/SmartFittingClass( 2871): InitialCheck, WhiteListStatus returned from CodecSolution : 0
I/SmartFittingClass( 2871): InitialCheck, [State:FINISHED] SmartFitting has not been activated by App. Shut Down SmartFitting.
I/ACodec ( 2871): [OMX.Exynos.avc.dec] Now handling output port settings change
W/AHierarchicalStateMachine( 2871): Warning message AMessage(what = 'omxI') = {
W/AHierarchicalStateMachine( 2871): int32_t type = 0
W/AHierarchicalStateMachine( 2871): int32_t event = 3
W/AHierarchicalStateMachine( 2871): int32_t data1 = 1
W/AHierarchicalStateMachine( 2871): int32_t data2 = 117440527
W/AHierarchicalStateMachine( 2871): } unhandled in root state.
D/SurfaceUtils( 2871): set up nativeWindow 0x6fc70df010 for 864x480, color 0x105, rotation 0, usage 0x602900
I/ACodec ( 2871): [OMX.Exynos.avc.dec] configureOutputBuffersFromNativeWindow setBufferCount : 14, minUndequeuedBuffers : 6
W/MapperHal( 2871): buffer descriptor with invalid usage bits 0x200000
I/chatty ( 2871): uid=10183(com.example.BethshanConnect) CodecLooper identical 3 lines
W/MapperHal( 2871): buffer descriptor with invalid usage bits 0x200000
I/ACodec ( 2871): [OMX.Exynos.avc.dec] Now Executing
I/ACodec ( 2871): [OMX.Exynos.avc.dec] OMX_EventPortSettingsChanged 0x7f030010
W/MapperHal( 2871): buffer descriptor with invalid usage bits 0x200000
I/chatty ( 2871): uid=10183(com.example.BethshanConnect) CodecLooper identical 1 line
W/MapperHal( 2871): buffer descriptor with invalid usage bits 0x200000
I/MediaCodec( 2871): setCodecState state : 1
W/MapperHal( 2871): buffer descriptor with invalid usage bits 0x200000
D/NdkImageReader( 2871): acquireImageLocked: Overriding buffer format YUV_420_888 to 0x105.
W/MapperHal( 2871): buffer descriptor with invalid usage bits 0x200000
I/MediaCodec( 2871): setCodecState state : 0
D/ ( 2871): PlayerBase::stop() from IPlayer
D/AudioTrack( 2871): stop(1340): called with 483848 frames delivered
Try using the following:
flags: YoutubePlayerFlags(
autoPlay: true,
mute: false,
),
Ah yes that's it, what a silly mistake! Thanks 馃槃
Most helpful comment
Try using the following: