Android MediaPlayer action OnCompleteListener after preparing -
after opening app , select first song play, mediaplayer
action oncompletelistener
, skip next song.this glitch appear 1 time after opening app , pretty annoying.any ideea how can solve ? think using preparelistener correctly.
mediaplayer.setonpreparedlistener(new mediaplayer.onpreparedlistener() { @override public void onprepared(mediaplayer mp) { mp.start(); } }); mediaplayer.setoncompletionlistener(new mediaplayer.oncompletionlistener() { @override public void oncompletion(mediaplayer mp) { if (currentposition < musicurl.size() - 1) { currentposition = currentposition + 1; url = musicurl.get(currentposition); uri uri = uri.parse(url); try { mediaplayer.stop(); mediaplayer.reset(); mediaplayer.setdatasource(url); mediaplayer.prepareasync(); musiccontroller.setcurrentsong(mydatalist.get(currentposition)); } catch (ioexception e) { e.printstacktrace(); } } } });
also logcat:
05-15 15:51:23.438 22818-22818/ d/drawerview? oninsetschanged() 05-15 15:51:24.917 22818-22834/ v/audiosystem? ioconfigchanged() event 0, iohandle 4 05-15 15:51:24.917 22818-22834/ v/audiosystem? ioconfigchanged() opening existing output! 4 05-15 15:51:24.917 22818-22834/ v/audiosystem? ioconfigchanged() event 0, iohandle 2 05-15 15:51:24.917 22818-22834/ v/audiosystem? ioconfigchanged() opening existing output! 2 05-15 15:51:26.287 22818-22818/ i/viewrootimpl? viewroot's touch event : action_down 05-15 15:51:26.366 22818-22818/ i/viewrootimpl? viewroot's touch event : action_up 05-15 15:51:26.373 22818-22818/ v/mediaplayer[native]? stop 05-15 15:51:26.373 22818-22818/ e/mediaplayer[native]? stop called in state 1 05-15 15:51:26.373 22818-22818/ v/mediaplayer[native]? message received msg=100, ext1=-38, ext2=0 05-15 15:51:26.373 22818-22818/ e/mediaplayer[native]? error (-38, 0) 05-15 15:51:26.373 22818-22818/ v/mediaplayer[native]? callback application 05-15 15:51:26.373 22818-22818/ v/mediaplayer[native]? callback 05-15 15:51:26.374 22818-22818/ v/mediaplayer[native]? reset 05-15 15:51:26.374 22818-22818/ v/mediaplayer[native]? before disconnect p = 0x0 05-15 15:51:26.389 22818-22818/ i/brunchxmlparserimpl? [brunchxmlparserimpl::findindexbykey] typeindex < 0 05-15 15:51:26.400 22818-22818/ i/brunchfeatureswitchex? [removefeatureswitchexlastitem] size = 14 05-15 15:51:26.400 22818-22818/ i/brunchfeatureswitchex? [removefeatureswitchexlastitem] size = 13 05-15 15:51:26.400 22818-22818/ i/brunchfeatureswitchex? [removefeatureswitchexlastitem] size = 12 05-15 15:51:26.400 22818-22818/ i/brunchxmlparserimpl? [brunchxmlparserimpl::findindexbykey] typeindex < 0 05-15 15:51:26.400 22818-22818/ i/brunchfeatureswitchex? [removefeatureswitchexlastitem] size = 11 05-15 15:51:26.400 22818-22818/ i/brunchxmlparserimpl? [brunchxmlparserimpl::findindexbykey] typeindex < 0 05-15 15:51:26.400 22818-22818/ i/brunchfeatureswitchex? [removefeatureswitchexlastitem] size = 10 05-15 15:51:26.400 22818-22818/ i/brunchxmlparserimpl? [brunchxmlparserimpl::findindexbykey] typeindex < 0 05-15 15:51:26.400 22818-22818/ i/brunchfeatureswitchex? [removefeatureswitchexlastitem] size = 9 05-15 15:51:26.400 22818-22818/ i/brunchxmlparserimpl? [brunchxmlparserimpl::findindexbykey] typeindex < 0 05-15 15:51:26.400 22818-22818/ i/brunchfeatureswitchex? [removefeatureswitchexlastitem] size = 8 05-15 15:51:26.400 22818-22818/ i/brunchfeatureswitchex? [removefeatureswitchexlastitem] size = 7 05-15 15:51:26.400 22818-22818/ i/brunchfeatureswitchex? [removefeatureswitchexlastitem] size = 6 05-15 15:51:26.400 22818-22818/ i/brunchfeatureswitchex? [removefeatureswitchexlastitem] size = 5 05-15 15:51:26.401 22818-22818/ i/brunchfeatureswitchex? [removefeatureswitchexlastitem] size = 4 05-15 15:51:26.401 22818-22818/ i/brunchfeatureswitchex? [removefeatureswitchexlastitem] size = 3 05-15 15:51:26.401 22818-22818/ i/brunchfeatureswitchex? [removefeatureswitchexlastitem] size = 2 05-15 15:51:26.401 22818-22818/ i/brunchfeatureswitchex? [removefeatureswitchexlastitem] size = 1 05-15 15:51:26.402 22818-22818/ v/propertyfrombrunch? insert brunchfeatureinfo strm.comm.video_max_h, defaults, video:maxwidth 05-15 15:51:26.402 22818-22818/ v/propertyfrombrunch? insert brunchfeatureinfo strm.comm.video_max_w, defaults, video:maxheight 05-15 15:51:26.402 22818-22818/ v/propertyfrombrunch? insert brunchfeatureinfo strm.rtsp.rtp_port_min, rtsps, port:min 05-15 15:51:26.402 22818-22818/ v/propertyfrombrunch? insert brunchfeatureinfo strm.rtsp.rtp_port_max, rtsps, port:max 05-15 15:51:26.402 22818-22818/ v/propertyfrombrunch? insert brunchfeatureswitch strm.feature.use_proxy, newfeatures, streaming:useproxy 05-15 15:51:26.402 22818-22818/ d/brunchutilityimpl? [makeuseragentinfo] representative features_ex xml 05-15 15:51:26.402 22818-22818/ d/brunchutilityimpl? [makeuseragentinfo] useragent 05-15 15:51:26.402 22818-22818/ d/brunchutilityimpl? [makeuseragentinfo] csuseragenttype[11100] 05-15 15:51:26.402 22818-22818/ w/brunchutilityimpl? [makeuseragentinfo] model name, version, default user-agent 05-15 15:51:26.402 22818-22818/ w/brunchutilityimpl? [makeuseragent] ro.lge.swversion_short [v20h] 05-15 15:51:26.402 22818-22818/ w/brunchutilityimpl? [makeuseragent] networkplay_default_user_agent 05-15 15:51:26.402 22818-22818/ v/propertyfrombrunch? [getpropertyint32] found key : strm.feature.use_proxy, value : 0 05-15 15:51:26.402 22818-22818/ v/mediaplayer[native]? setdatasource 05-15 15:51:26.406 22818-22818/ v/mediaplayer[native]? setvideosurfacetexture 05-15 15:51:26.406 22818-22818/ v/mediaplayer[native]? prepareasync 05-15 15:51:26.408 22818-22834/ v/mediaplayer[native]? message received msg=8, ext1=0, ext2=0 05-15 15:51:26.411 22818-22834/ v/mediaplayer[native]? unrecognized message: (8, 0, 0) 05-15 15:51:26.411 22818-22834/ v/mediaplayer[native]? callback application 05-15 15:51:26.411 22818-22834/ v/mediaplayer[native]? callback 05-15 15:51:26.414 22818-22818/ v/mediaplayer[native]? start 05-15 15:51:26.414 22818-22818/ e/mediaplayer[native]? start called in state 4 05-15 15:51:26.414 22818-22818/ v/mediaplayer[native]? message received msg=100, ext1=-38, ext2=0 05-15 15:51:26.414 22818-22818/ e/mediaplayer[native]? error (-38, 0) 05-15 15:51:26.414 22818-22818/ v/mediaplayer[native]? callback application 05-15 15:51:26.414 22818-22818/ v/mediaplayer[native]? callback 05-15 15:51:26.426 22818-22818/ d/drawerview? oninsetschanged() 05-15 15:51:26.434 22818-22981/ e/mediahttpconnectionex? mediahttpconnectionex contructor 05-15 15:51:26.434 22818-22836/ e/mediahttpconnectionex? connect 05-15 15:51:26.435 22818-22836/ e/mediahttpconnectionex? disconnecting 05-15 15:51:26.436 22818-22836/ e/mediahttpconnectionex? disconnected 05-15 15:51:26.438 22818-22834/ e/mediahttpconnectionex? [getmimetype] mcontenttype:application/octet-stream 05-15 15:51:26.438 22818-22834/ e/mediahttpconnectionex? [seektoex] offset:0/mcurrentoffset:-1 05-15 15:51:26.440 22818-22834/ d/mediahttpconnectionex? [seektoex] http header =>user-agent: lg-d855/v20h player/lg player 1.0 android 5.0 (stagefright alternative) 05-15 15:51:26.440 22818-22834/ d/mediahttpconnectionex? [seektoex] include range: bytes= 0- 05-15 15:51:26.440 22818-22834/ d/mediahttpconnectionex? [seektoex] http header =>range: bytes=0- 05-15 15:51:26.451 22818-22818/ e/mediaplayer? error (-38,0) 05-15 15:51:26.451 22818-22818/ v/mediaplayer[native]? stop 05-15 15:51:26.452 22818-22818/ e/mediaplayer[native]? stop called in state 0 05-15 15:51:26.452 22818-22818/ v/mediaplayer[native]? message received msg=100, ext1=-38, ext2=0 05-15 15:51:26.452 22818-22818/ e/mediaplayer[native]? error (-38, 0) 05-15 15:51:26.452 22818-22818/ v/mediaplayer[native]? callback application 05-15 15:51:26.452 22818-22818/ v/mediaplayer[native]? callback 05-15 15:51:26.452 22818-22818/ v/mediaplayer[native]? reset 05-15 15:51:26.452 22818-22981/ v/mediaplayer[native]? message received msg=8, ext1=0, ext2=0 05-15 15:51:26.452 22818-22818/ e/mediahttpconnectionex? disconnecting 05-15 15:51:26.452 22818-22818/ e/mediahttpconnectionex? this.mconnection.disconnect(); 05-15 15:51:26.453 22818-22818/ e/mediahttpconnectionex? this.mconnection.disconnected; 05-15 15:51:26.453 22818-22818/ e/mediahttpconnectionex? disconnected 05-15 15:51:26.484 22818-23458/ e/mediahttpconnectionex? [seektoex] offset:0/mcurrentoffset:-1 05-15 15:51:26.487 22818-22981/ v/mediaplayer[native]? notify(8, 0, 0) callback on disconnected mediaplayer 05-15 15:51:26.487 22818-22981/ v/mediaplayer[native]? message received msg=100, ext1=1, ext2=-2147483648 05-15 15:51:26.487 22818-22981/ e/mediaplayer[native]? error (1, -2147483648) 05-15 15:51:26.487 22818-22981/ v/mediaplayer[native]? callback application 05-15 15:51:26.487 22818-22818/ v/mediaplayer[native]? before disconnect p = 0x9d44cf80 05-15 15:51:26.487 22818-22818/ v/mediaplayer[native]? reset disconnect 05-15 15:51:26.488 22818-22981/ v/mediaplayer[native]? callback 05-15 15:51:26.488 22818-22834/ e/mediahttpconnectionex? [seektoex] offset:0/mcurrentoffset:-1 05-15 15:51:26.488 22818-22834/ d/mediahttpconnection? unknown exception java.lang.nullpointerexception: attempt invoke virtual method 'java.net.urlconnection java.net.url.openconnection()' on null object reference 05-15 15:51:26.488 22818-22818/ v/propertyfrombrunch? [getpropertyint32] found key : strm.feature.use_proxy, value : 0 05-15 15:51:26.488 22818-22834/ d/mediahttpconnection? readat 0 / 32768 => -1 05-15 15:51:26.488 22818-22818/ v/mediaplayer[native]? setdatasource 05-15 15:51:26.491 22818-22981/ v/mediaplayer[native]? message received msg=8, ext1=0, ext2=0 05-15 15:51:26.491 22818-22981/ v/mediaplayer[native]? notify(8, 0, 0) callback on disconnected mediaplayer 05-15 15:51:26.491 22818-22818/ v/mediaplayer[native]? setvideosurfacetexture 05-15 15:51:26.491 22818-22818/ v/mediaplayer[native]? prepareasync
the solution of problem call mediaplayer
onerrorlistener, when error occured retrying mediaplayer same url.
Comments
Post a Comment