Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7732351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:42:33+00:00 2026-06-01T06:42:33+00:00

I have an application thats main goal is to play a specific video file.

  • 0

I have an application thats main goal is to play a specific video file.

it plays the video correctly sometimes. But other times it gives me this error:

03-21 14:52:36.181: I/AwesomePlayer(119): 
setDataSource_l('/data/data/my.package.name/files/MyMovie.mp4')
03-21 14:52:36.196: W/VideoView(26612): Unable to open content: /data/data/my.package.name/files/MyMovie.mp4
03-21 14:52:36.196: W/VideoView(26612): java.lang.IllegalArgumentException: The surface has been released
03-21 14:52:36.196: W/VideoView(26612):     at android.media.MediaPlayer._setVideoSurface(Native Method)
03-21 14:52:36.196: W/VideoView(26612):     at android.media.MediaPlayer.setDisplay(MediaPlayer.java:633)
03-21 14:52:36.196: W/VideoView(26612):     at android.widget.VideoView.openVideo(VideoView.java:222)
03-21 14:52:36.196: W/VideoView(26612):     at android.widget.VideoView.access$2000(VideoView.java:49)
03-21 14:52:36.196: W/VideoView(26612):     at android.widget.VideoView$6.surfaceCreated(VideoView.java:465)
03-21 14:52:36.196: W/VideoView(26612):     at android.view.SurfaceView.updateWindow(SurfaceView.java:533)
03-21 14:52:36.196: W/VideoView(26612):     at android.view.SurfaceView.access$000(SurfaceView.java:81)
03-21 14:52:36.196: W/VideoView(26612):     at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:169)
03-21 14:52:36.196: W/VideoView(26612):     at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:590)
03-21 14:52:36.196: W/VideoView(26612):     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1617)
03-21 14:52:36.196: W/VideoView(26612):     at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
03-21 14:52:36.196: W/VideoView(26612):     at android.os.Handler.dispatchMessage(Handler.java:99)
03-21 14:52:36.196: W/VideoView(26612):     at android.os.Looper.loop(Looper.java:137)
03-21 14:52:36.196: W/VideoView(26612):     at android.app.ActivityThread.main(ActivityThread.java:4424)
03-21 14:52:36.196: W/VideoView(26612):     at java.lang.reflect.Method.invokeNative(Native Method)
03-21 14:52:36.196: W/VideoView(26612):     at java.lang.reflect.Method.invoke(Method.java:511)
03-21 14:52:36.196: W/VideoView(26612):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
03-21 14:52:36.196: W/VideoView(26612):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
03-21 14:52:36.196: W/VideoView(26612):     at dalvik.system.NativeStart.main(Native Method)
03-21 14:52:36.196: D/VideoView(26612): Error: 1,0

I am using the prepared listener to call start like this:

mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
    @Override
    public void onPrepared(MediaPlayer arg0) {
        mVideoView.start();

    }
});

And I set the data source with this:

file = new File(this.getFilesDir() + File.separator + VIDEO_FILE_NAME);
mVideoView.setVideoPath(file.getAbsolutePath());

I know for certain that the file does exist and is the proper format.

My application has the ability to be launched from an alarm trigger. It seems to only be a problem when the trigger fires and launches my app while the devices screen is turned off(my app will turn the screen on with a wake lock). If I manually launch the app, or the trigger happens with the screen on the video plays fine. This error is also only occuring on the Galaxy Nexus. I can run the exact same code on a Nexus S(as well as a long list of others) and it starts fine every time.

Does anyone know of anything specific to the Galaxy Nexus or ICS that could cause this behavior? And are there any suggestions for what I could try to fix?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T06:42:34+00:00Added an answer on June 1, 2026 at 6:42 am

    UThis is connected to your SurfaceView.
    Make sure you don’t touch the SurfaceView after you have called prepare on you MediaPlayer and that it is visible. In your case where you try to wake up the screen make sure that everything happens in the correct order. So preparing the MediaPlayer for playback is the very last thing which your app should do. It could be that the prepare/playback is initiated prior to the app being fully awake, causing the app to attempt to manipulate the SurfaceView.

    The follow code example illustrates how to trigger that kind of exception:

       private void setupVideo(String file){
          ...
          mSurfaceView = (SurfaceView) findViewById(R.id.surface);
          mHolder = mSurfaceView.getHolder(); // DON'T TOUCH BEHIND THIS POINT
          mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
          mMediaPlayer.setDisplay(mHolder);
          mMediaPlayer.setOnPreparedListener(this);
          mMediaPlayer.prepare();
       }
       @Override
       public void onPrepared(final MediaPlayer mp) {
          mSurfaceView.setVisibility(View.VISIBLE); // THIS WILL CAUSE THE ERROR
          mp.start();
       }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function thats the main bottleneck of my application, because its doing
I have an application with a main window that loads in text file(s) and
Main goal: To have two builds of the same application on my phone. What
I have an application that lives in the menubar, without a main menu or
I have an application that has two threads. The first one (the main thread)
I have a Delphi application that has a document browser as the main form.
In my Backbone application I have a main view that shows previews of posts.
I have module application. When I run it, the main window of that app
I have my main application delegate which contains a method that returns an object.
In my application I have several activities, the main screen has 4 buttons that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.