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 8455219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:13:46+00:00 2026-06-10T12:13:46+00:00

I try to play multiple videos in loop using MediaPlayer (Android ICS) and change

  • 0

I try to play multiple videos in loop using MediaPlayer (Android ICS) and change the videos each time when oncompletion() called.

It works great but after a random time the application freeze and I get the error :

[SurfaceView] connect : already connected (cur=3, req=3)
setVideoSurfaceTexture failed : -22

When this error happen, internally it call the reset player

ref : mediaplayer.cpp

if (err != OK) {
    LOGE("setVideoSurfaceTexture failed: %d", err);
    // Note that we must do the reset before disconnecting from the ANW.
    // Otherwise queue/dequeue calls could be made on the disconnected
    // ANW, which may result in errors.
    reset();
    disconnectNativeWindow();
    return err;
}

as per my code i get the notification for onprepared() and start playing.

Actually there is no playback due to this err.

So i try to reset the mediaplayer and call prepare() when this problem happened and mediaplayer is not playing, but i am not able to capture this bug ( mp.isPlaying()->true (bec’z called start() in onprepared()).

i try the logic like

onprepared() {
    mp.start();
    if (pbm : [SurfaceView] connect : already connected (cur=3, req=3)
                                      setVideoSurfaceTexture failed : -22  ) {
        reset the mediaplayer source and call prepare
    }
}

how can i locate this bug to restart the mediaplayer again?

  • 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-10T12:13:48+00:00Added an answer on June 10, 2026 at 12:13 pm

    we can avoid this problem by the following way…

       mediaPlayer.setDisplay(null);
    
       mediaPlayer.reset();
    

    after this set the surfaceholder again before start the mediaplayer

        mediaPlayer.setDisplay(surfaceHolder1);
    
        mediaPlayer.start();  in onprepared notification.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

so i am using the play framework and I'm try to create multiple submit
I try to restrict (using deadbolt ) something in my view ( play! framework
I want to try out Joda Time with Play Framework 2.0. So I have
I downloaded play-2.0.zip from the website. When I try to unzip it (using 7-zip),
I'm using macincloud service to try/play/learn about building iPhone apps. I have a dummy
I try to play jpg (in loop), after click mp4 should be played after
I am building a slider with multiple Vimeo videos using Woo Theme's Flexslider. I
I installed the BlackBerryPlayBookSimulator-Installer-1.0.8-6067-Win-201112052354 On windows7 and try to play on the VMWare player
I try open and play .wav files with NAudio lib. private OpenFileDialog openFileDialog =
I try to establish a build pipeline on Jenkins with a Play(2.0.2) project. As

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.