Problem using multiple instances of the Android MediaPlayer class

Am uses 2 instances of the Android MediaPlayer class to simultaneously play 2 videos as follows

mediaplayer1.setDataSource( Path to Video1 );

mediaplayer1.prepare();

mediaplayer2.setDataSource( Path to Video2 );

mediaplayer2.prepare();

An exception is thrown when invoking mediaplayer2 instance preparation.

But if I play the video separately without using multiple instances, it works great.

The log information received from logcat is as follows: -

01-08 17:07:32.785: V/MediaPlayer(19201): setVideoSurfaceTexture

01-08 17:07:32.785: V/MediaPlayerService(12734): [176] setVideoSurfaceTexture(0x0)

01-08 17:07:32.785: V/MediaPlayer(19201): prepare

01-08 17:07:32.785: V/MediaPlayerService(12734): [176] setAudioStreamType(3)

01-08 17:07:32.785: V/MediaPlayerService(12734): [176] prepareAsync

01-08 17:07:32.785: V/AwesomePlayer(12734): prepareAsync

01-08 17:07:32.785: V/AwesomePlayer(12734): onPrepareAsyncEvent

01-08 17:07:32.785: I/SecMediaClock(12734): SecMediaClock constructor

01-08 17:07:32.785: I/SecMediaClock(12734): reset

01-08 17:07:32.785: V/AwesomePlayer(12734): initVideoDecoder flags=0x0

01-08 17:07:32.785: I/OMXCodec(12734): OMXCodec::Create mime (video/avc), flags (0), matchComponentName ((null)), createEncoder (0)

01-08 17:07:32.785: I/OMXCodec(12734): Attempting to allocate OMX node 'OMX.SEC.avc.dec'

01-08 17:07:32.785: D/OMX(12734): SendBroadCasting VIDEO_PLAYBACK_START

01-08 17:07:32.790: I/OMXCodec(12734): Successfully allocated OMX node 'OMX.SEC.avc.dec'

01-08 17:07:32.790: I/OMXCodec(12734): [OMX.SEC.avc.dec] AVC profile = 77 (Main), level = 40

01-08 17:07:32.790: I/OMXCodec(12734): [OMX.SEC.avc.dec] FrameRate (24)

01-08 17:07:32.790: I/OMX(12734): width (1914), height (848), fps (24)

01-08 17:07:32.790: E/OMX(12734):  setParam  sum(3246144) > max resolution(3010560)

01-08 17:07:32.790: D/OMX(12734): SendBroadCasting VIDEO_PLAYBACK_STOP

01-08 17:07:32.790: E/OMXCodec(12734):  OmxCodec Create multi window instance fail  appPid : 19201

01-08 17:07:32.795: D/WFDService(13028): intent recieved android.intent.action.VIDEO_PLAYBACK_STOP

01-08 17:07:32.795: E/WFDService(13028): FHD : android.intent.action.VIDEO_PLAYBACK_STOP

01-08 17:07:32.810: E/Bundle(13028): readBundle: bad magic number

01-08 17:07:32.810: E/Bundle(13028): readBundle: trace = java.lang.RuntimeException

01-08 17:07:32.810: E/Bundle(13028):    at android.os.Bundle.readFromParcelInner(Bundle.java:1677)

01-08 17:07:32.810: E/Bundle(13028  at android.os.Bundle.<init>(Bundle.java:83)

01-08 17:07:32.810: E/Bundle(13028):    at android.os.Parcel.readBundle(Parcel.java:1579)

01-08 17:07:32.810: E/Bundle(13028):    at android.os.Parcel.readBundle(Parcel.java:1564)

01-08 17:07:32.810: E/Bundle(13028):    at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:371)

01-08 17:07:32.810: E/Bundle(13028):    at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2125)

01-08 17:07:32.810: E/Bundle(13028):    at android.os.Binder.execTransact(Binder.java:388)

01-08 17:07:32.810: E/Bundle(13028):    at dalvik.system.NativeStart.run(Native Method)

01-08 17:07:32.810: V/AwesomePlayer(12734): notifyListner_l() msg (100-MEDIA_ERROR), ext1 (1), ext2 (-2147483648)

01-08 17:07:32.810: V/MediaPlayerService(12734): [176] notify (0x40065290, 100, 1, -2147483648)

01-08 17:07:32.810: V/MediaPlayer(19201): message received msg=100, ext1=1, ext2=-2147483648

01-08 17:07:32.810: E/MediaPlayer(19201): error (1, -2147483648)

When I check the log, I find that the main cause of the problem is the value SetParam sum (3246144)> max (3010560). I searched a lot about this, but I did not get any information related to this. Can someone help me deal with this issue?

I am using Galaxy S3 with Android 4.3.

Thanks in advance.

+4

All Articles