Log in or register to post comments

videoplayback demo error when adding more video

December 13, 2012 - 1:26am #1

Hi, I have been playing around with the videoplayback demo, it works fine until I add more video to it.

I have make 6 trackables for 6 videos, on one of my phone, it can play all 6 videos successfully.

But for another android phone, it can only play 4 and for another tablet it can only play 3

I have checked the log, the error occurs when it prepare the mediaplayer at mMediaPlayer.prepareAsync(); in VideoPlayerHelper.java

related logs:

12-13 17:15:10.247: E/OMXNodeInstance(14298): OMX_UseBuffer failed with error -2147479528 (0x80001018)

12-13 17:15:10.247: E/OMXCodec(14298): [OMX.TI.DUCATI1.VIDEO.DECODER] ERROR(0x80001000, 0)

12-13 17:15:10.247: W/AwesomePlayer(14298): onPrepareAsyncEvent() initVideoDecoder error(-2147483648)

12-13 17:15:10.247: E/MediaPlayer(15561): error (1, -2147483648)

12-13 17:15:10.247: D/DOMX(14298): ERROR: failed check:(eError == OMX_ErrorNone) || (eError == OMX_ErrorNoMore) - returning error: 0x80001000 - Error returned from OMX API in ducati

12-13 17:15:10.247: D/DOMX(14298): ERROR: Error From ComponentDeInit..

12-13 17:15:10.286: E/MediaPlayer(15561): Error (1,-2147483648)

12-13 17:15:10.286: E/QCAR(15561): Error while opening the file for fullscreen. Unloading the media player (Unspecified media player error, -2147483648)

12-13 17:15:10.286: E/MediaPlayer(15561): error (-38, 0)

 
I tried with different video but the result is the same, it can only play the first 3 or 4 video.
 
Any help? thanks

 

videoplayback demo error when adding more video

July 23, 2019 - 4:13pm #33

1/Remove this code from onSurfaceCreated in VideoPlaybackRenderer.java : 

if (mLoadRequested[i])

                {

                    mVideoPlayerHelper[i].load(mMovieName[i],

                        mCanRequestType[i], mShouldPlayImmediately[i],

                        mSeekPosition[i]);

                    mLoadRequested[i] = false;

                }

 

2/ Remove this code from onSurfaceChanged in VideoPlaybackRenderer.java :

if (mLoadRequested[i] && mVideoPlayerHelper[i] != null)

            {

                mVideoPlayerHelper[i].load(mMovieName[i], mCanRequestType[i],

                    mShouldPlayImmediately[i], mSeekPosition[i]);

                mLoadRequested[i] = false;

            }

 

3/Replace onDrawFrame(GL10 gl) function in VideoPlaybackRenderer.java with this code :

 

public void onDrawFrame(GL10 gl)

    {

        if (!mIsActive)

            return;

        for (int i = 0; i < VideoPlayback.NUM_TARGETS; i++)

        {

            if (mVideoPlayerHelper[i] != null)

            {

                if (mVideoPlayerHelper[i].isPlayableOnTexture())

                {

                    if (mVideoPlayerHelper[i].getStatus() == MEDIA_STATE.PLAYING)

                    {

                        mVideoPlayerHelper[i].updateVideoData();

                    }



                    mVideoPlayerHelper[i]

                        .getSurfaceTextureTransformMatrix(mTexCoordTransformationMatrix[i]);

                 

                    setVideoDimensions(i,

                        mVideoPlayerHelper[i].getVideoWidth(),

                        mVideoPlayerHelper[i].getVideoHeight(),

                        mTexCoordTransformationMatrix[i]);

                }

                setStatus(i, mVideoPlayerHelper[i].getStatus().getNumericType());

            }

        }

        // Call our function to render content from SampleAppRenderer class

        mSampleAppRenderer.render();

        for (int i = 0; i < VideoPlayback.NUM_TARGETS; i++)

        {

            if (isTracking(i))

            {

                if (mLoadRequested[i])

            {

                

                try{

                    if(last != -1){

                        mVideoPlayerHelper[last].unload();

                    }

                }catch (Exception e){

                }

                mVideoPlayerHelper[i].load(mMovieName[i], mCanRequestType[i],

                    mShouldPlayImmediately[i], mSeekPosition[i]);

                mLoadRequested[i] = false;

                last = i ;

            }

                if (mVideoPlayerHelper[i] != null)

                    mVideoPlayerHelper[i].play(false, -1);

            }

            else

            {

                if (mVideoPlayerHelper[i] != null)

                    mVideoPlayerHelper[i].pause();

            }

        }

 

    }

 

PS: the last variable is defined to store the index of last played video, you define it in the classe and give it an initial value of -1

 

 

videoplayback demo error when adding more video

December 8, 2015 - 4:05am #32

HI,

Error while opening the file . Unloading the media player (Unspecified media player error, -2147483648)

Please any one tell me the solution.

videoplayback demo error when adding more video

July 8, 2015 - 10:57pm #31

gn1749465 wrote:

Now I only load the video when target is detected and unload it when not detected, and now it works fine

Thanks for your help!

 

hi 

how to load and unload video in vuforia 3 video playback?
can you help me ? (show a sample)

videoplayback demo error when adding more video

May 19, 2015 - 8:27pm #30

Hi,

Could you please explain how did you play video using URL?

I have this error when I'm trying to do that 

( Error while opening the file. Unloading the media player (Unspecified media player error, -1004)

videoplayback demo error when adding more video

July 9, 2014 - 12:21am #29

Hi,

     I have tried playing the videos from my asset folder. It works fine for me.  I had tried to play a video for one image target using Url  it works fine. But i don't know how to use several url videos. Can anyone suggest me the solution?

Thanks in advance.

videoplayback demo error when adding more video

January 16, 2014 - 3:29am #28

Hi AlessandroB

Yes, and we have managed it without any problem (dynamic load & unload). The problem is that loading a video at the moment we detect the target, te texture where we will play the video (all are devices with Android +4.1.2 versiones, using ON_TEXTURE playback: S4, S3, Nexus5,Galaxy Nexus...)  turns black for a moment, until the video has benn loaded and it start to play. There are some blak frames before the video playing. If we scan the target again, there are no black frames, because video is loaded.

If we load all the videos (in our case, around 17) at the beginning (as your sample do), it doesn't happen, but then we have the other problem you mention. ( in some devices, basically devices with less A7 CPU and less than 2GB RAM S3, Galaxy Nexus).

Any idea to solve this black frames when loading the video for first time?

Thank you very much.

videoplayback demo error when adding more video

January 16, 2014 - 1:52am #27

Hi, if you search the Forum, you will find that this topic has been discussed several times; what you need to do is to implement a dynamic loading and unloading of videos; i.e. if a target is lost, you should unload its video; otherwise, you will always incur in some memory/resource limitations when attemopting to load and play multiple videos. The limitations will vary depending on which device you are using, as you also observed..

 

videoplayback demo error when adding more video

January 15, 2014 - 11:33pm #26

One more issue. Now I'm loading the video when I detect the target, so it takes more time to load, but it isn't a problem. The problem is that a black frame is shown during some frames before the video is loaded.

This is quite inconvenient because our videos are chroma videos, because are integrated with the reality, so these black frames spoil our work.

Any help to avoid these black rames (hidding videos X frames/seconds at the beggining....)?

Thanks

videoplayback demo error when adding more video

January 14, 2014 - 1:17am #25

Now, with de new 2.8 version the problem is still there :(

I am developing a project and the stats are:

  • Galaxy S4 plays a lot of videos
  • Galaxy S3 plays 4 videos, fail on 5th
  • Galaxy S2 plays ok 1 video
  • Galaxy Nexus plays ok only 1 video

The problem is Android MediaPlayer that pass away, inside the array of VideoPlayerHelper when we add more videos. If you add all the videos at the beginning, most of the devices don't play anything. You must load every video when you detect the target, and this adds a new problem: black frame at the beginnin of the video due to Unity render buffer.

I hope Vuforia team can update these issues in the next update.

 

Thanks

videoplayback demo error when adding more video

November 30, 2013 - 3:48am #24

can i see a sample code how you remove the load and unload functions there? im new here.. and i want to know more about this vuforia :)

I hope you can help me. Thanks in advance :)

videoplayback demo error when adding more video

October 30, 2013 - 12:43pm #23

Can anyone please post a sample of his/her code that can load video when detecet the target ? 

 

videoplayback demo error when adding more video

August 2, 2013 - 2:42am #22

Thanks sushiljha. You were right.That was related android memory size and sometimes its crash there.

Best Regards

videoplayback demo error when adding more video

May 8, 2013 - 5:00pm #21

Hey mustafacelik,

 

Yours is surely video decoding issue. Different phones have different decoders provided by manufactures. And some decoders can fail for specific videos. So, though your phone may have m4v decoder, it may be failing for that specific video or may be the decoder is not present :)

To answer to one of the questions in the chain below, it is not about the size of the video whic will cause the crash. For each video, mediaplayer engine allocates buffers for decoding and rendering. So, when we add more videos and play them. the engine has to add more decoding and rendering buffers for that video as well. So, normally after adding 3-4 videos, the mediaplayer engine is not capable of creating more buffers as its memory is exausted (every android app can use max specific size memory only.) and will crash.

videoplayback demo error when adding more video

May 8, 2013 - 4:07am #20

Ok, so it sounds very much like a video encoding issue; also, some video formats are supported only on certain Android versions (e.g. 3.0, or 4.0 or 4.1);

you may want to check this page on Android media formats:

http://developer.android.com/guide/appendix/media-formats.html

 

videoplayback demo error when adding more video

May 8, 2013 - 3:03am #19

As you told,I try to use sample videos at application and video popup and works well.I still cant understand why my video not working ? Its .m4v formatted and its working some devices but not else.After I see my video had problem,I convert mp4 formatted but still I have same problem as i type before with red colored error.What I must do to solve problem? Is the problem about video codec ?

videoplayback demo error when adding more video

May 6, 2013 - 10:30am #18

Ok. Have you made significant changes to the original sample App?

one thing you could test (or ask your client to test), is to try your App, but using the videos provided with the official VP sample;

if the crash does not show up, this would indicate a problem with that specific video...

Also, it would be good to make also the opposite test, i.e. to test the official VP sample (instead of your App) using your custom video (instead of the sample videos).

Making these two tests would tell us a bit more on the source of the problem.

videoplayback demo error when adding more video

May 6, 2013 - 9:33am #17

Hi AlessandroB,

The video format is .m4v and I just try to use fullscreen player when target found.This video works right at Xperia devices but not HTC One SV and some of other devices too.While I develop projects,I use Xperia and that error not appear.after client check applications at her phone,she inform me that video not start well when target found.its frozen and just first frame of video popups at fullscreen but nothing more.

videoplayback demo error when adding more video

May 6, 2013 - 8:29am #16

Hi mustafacelik,

that error message comes from the OnErrorListener which is installed in the FullscreenPlayback class (see onError() method in FullscreenPlayback.java).

Since the error message is "Unspecified media player error", it is hard to tell what goes wrong; are you using a specific video file ? can you provide maybe a bit more context ?

 

 

videoplayback demo error when adding more video

May 6, 2013 - 6:52am #15

Even I just have one video to play when texture found, this error appears at logcat. How can i can fix this error ? Please can you inform properly with codes or directions.

Error as below:

 

Error while opening the file for fullscreen. Unloading the media player (Unspecified media player error, -2147483648)

Best Regards

videoplayback demo error when adding more video

April 23, 2013 - 11:13am #14

I did it  on the true case of the conditional if( isTracking(i) ) on the onDrawFrame method and it worked

hope it helps

videoplayback demo error when adding more video

April 23, 2013 - 5:35am #13

i have removed load() method calling from both onSurfaceCreated() & onSurfaceChanged()..

can you just tell me where to call load() and unload() functions  ???

videoplayback demo error when adding more video

March 25, 2013 - 2:11am #12

Good, if you find some extra tips / tricks about the Media Player, feel free to share them here. 

videoplayback demo error when adding more video

March 23, 2013 - 11:55pm #11

Ok
I guess I will investigate more in some android sdk forum, tough the application now runs fine it's something I want to clear up.

Thanks for your time and your fast answer.

videoplayback demo error when adding more video

March 22, 2013 - 12:05pm #10

Hi,

not sure if there is a direct / linear relationship between the size of the videos and the memory consumption; you must also consider that the MediaPlayer might need to allocate extra resources which are not directly related to the size of the video being played.

The complete explanation of this is probably down in the details of the Android Media Player implementation; you may want to address this question to the Android SDK support / forums.

 

videoplayback demo error when adding more video

March 22, 2013 - 10:44am #9

 

Hi!

I´ve been developing an application based on the Vuforia VideoPlayback sample but with 9 videos with 9 trackables, I was stuck with some Media Player Errors until I found help in this post it seems that my phone only supports 4 videos loaded simultaneously, with the advices here I get to load and unload videos so the maximum of videos loaded is 4, since I read that this was a problem with the consume of memory on the device my question here its: why when I try to load 4 videos with a size of 10Mb each one the applicattion doesnt crash but when i try to load 5 videos of 1Mb each one the applicattion log shows

 

03-22 11:32:53.136: E/MediaPlayer(23474): error (100, 0)
03-22 11:32:53.136: E/MediaPlayer(23474): Error (100,0)
03-22 11:32:53.136: E/QCAR(23474): Error while opening the file. Unloading the media player (Media server died, 0)
03-22 11:32:53.136: E/MediaPlayer(23474): stop called in state 0
03-22 11:32:53.136: E/MediaPlayer(23474): error (-38, 0)
03-22 11:32:53.136: E/MediaPlayer(23474): Error (100,0)

?

I don´t know if I have explained myself clearly but the thing is that I don´t know if there´s a problem with the implementation of the Media Player class or something like that

any ideas?

thanks for your help

 

OK, I see; basically, if your

January 11, 2013 - 6:24am #8

OK, I see; basically, if your application requirement is to pause a video when not tracked and then being able to resume the paused video when the trackable is detected again, then this is a bit in conflict with the possiblity of unloading the video;

what I would suggest in this case is to make the video load/unload logic a bit more sophisticated, i.e. instead of unloading the video immediately when tracking is lost, you could just pause the video;

then when you detect a new target, you could check how many videos you have already loaded (including currently paused ones), and in case you have more than 2 or 3 videos already in memory, then you could unload one of them (e.g. a video which was paused), so that the total number of videos never exceeds the 3 units.

So, it is in practice a matter of making sure than you never get more than 3 videos simultaneously in memory, and thus unloading only when really necessary;

also, when you unload a video, you could store the current position  in a variable, and then when you load it again, you could realign the video at the saved position, so that it looks like it is resumed from its last position;

I hope this makes sense to you.

 

 

unload stops video tracking

January 11, 2013 - 6:11am #7

Yes, I did not unload the video, i just pause the video while not tracking. Because if i track the image again i want to play the video from where it stop/pause. If i do unload, the video start play from first. Is there anyway i can stop this?

Pausing video on VideoPlaybackRenderer.onDrawFrame()... if (isTracking(i)) {//play video } else{ //pausing video }

 

Hi, you also need to unload

January 11, 2013 - 5:00am #6

Hi,

you also need to unload the videos that you are not using (when targets are not detected), otherwise you will incurr in memory problems and crashing;

could you check that you also do that?

 

Hi, As mentioned by you, i

January 11, 2013 - 4:04am #5

Hi,

As mentioned by you, i have removed load() method calling from both onSurfaceCreated() & onSurfaceChanged()

Added load method in VideoPlayback.onSingleTapConfirmed(MotionEvent e) as below

 

                    // Verify that the tap happened inside the target
                    if (isTapOnScreenInsideTarget(i, e.getX(), e.getY()))
                    {
                    mVideoPlayerHelper[i].load( mMovieName[i], MEDIA_TYPE.ON_TEXTURE, false, 0);
                      ...
                      ....
                    }
 
It works fine for 3 videos. When i add 4th video, it was able to detect the image and shows video with play icon, when i click play icon , it shows below error msg..
 
01-10 16:56:47.330: A/libc(10281): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)
01-10 16:56:47.330: W/AudioSystem(10281): AudioFlinger server died!
01-10 16:56:48.330: E/MediaPlayer(10281): error (100, 0)
01-10 16:56:48.330: E/MediaPlayer(10281): Mediaserver died in 8 state
01-10 16:56:48.340: E/MediaPlayer(10281): Error (100,0)
01-10 16:56:48.340: E/QCAR(10281): Error while opening the file. Unloading the media player (Media server died, 0)
01-10 16:56:48.340: E/MediaPlayer(10281): stop called in state 0
01-10 16:56:48.340: E/MediaPlayer(10281): error (-38, 0)
01-10 16:56:48.340: W/MediaPlayer(10281): mediaplayer went away with unhandled events
 
 

 

 

 

 

You're welcome!

December 17, 2012 - 2:22am #4

You're welcome!

Now I only load the video

December 16, 2012 - 9:55pm #3

Now I only load the video when target is detected and unload it when not detected, and now it works fine

Thanks for your help!

videoplayback demo error when adding more video

December 13, 2012 - 6:27am #2

Hi,

loading the videos for playback consumes memory on the device, so depending on the device you use you might face memory problems that cause the media player to fail; so some devices may be able to support more videos (e.g. 6)  than other devices (e.g. 3 or 4), that is expected and normal.

To overcome this problem you could refactor the VP sample so to load videos only when the corresponding target is detected, and to unload the video (thuis freeing the memory) when a target is no longer detected; this way you will be able to reduce the number of videos simultaneously loaded in memory and you should eb able to handle even more than 4 videos on all your devices.

Note:

- the load() and unload() functions are defined in VideoPlaybackHelper.java

- the load() function is called from the VideoPlaybackRenderer.java in the onSurfaceCreated() and onSurfaceChanged() methods;

you should remove those load() calls from there and should place them in some code which is triggered from the rendering function when a target is detected.

I hope this helps.

 

 

Log in or register to post comments