I am writing an application in which one of the actions could play video files. I record a video, but then when I try to start the game. The activity starts and the video plays for the first time. Then I press the "Back" button, return to the previous step, select a video (same or different), and the video will start playing again, all the views (buttons, icon, etc.) are shown, but the video is not displayed. I come back again, select the video, open the video and play the video again. Therefore, he plays every second time. I tried to debug, but could not find what the problem was and any help would be greatly appreciated. The following is the opcode as well as the output of logCat from eclipse.
public class FightPlayerActivity extends Activity implements OnSeekBarChangeListener, SurfaceHolder.Callback, OnPreparedListener { private MediaPlayer mp=null; private SeekBar seekBar; private String filePath; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Toast.makeText(this,"Create ", 2000).show(); setContentView(R.layout.fight_player); filePath=getIntent().getStringExtra("filename"); filePath=Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM)+"/FightAll_BJJ_Scoring/"+filePath; Toast.makeText(this,filePath, 2000).show();
and write down below:
08-19 18:26:39.325: E/MediaPlayer(7057): message received msg=200, ext1=1, ext2=44 08-19 18:26:39.325: W/MediaPlayer(7057): info/warning (1, 44) 08-19 18:26:39.325: E/MediaPlayer(7057): callback application 08-19 18:26:39.325: E/MediaPlayer(7057): back from callback 08-19 18:26:39.325: E/MediaPlayer(7057): message received msg=1, ext1=0, ext2=0 08-19 18:26:39.325: E/MediaPlayer(7057): callback application 08-19 18:26:39.325: E/MediaPlayer(7057): back from callback 08-19 18:26:39.361: E/MediaPlayer(7057): message received msg=5, ext1=176, ext2=144 08-19 18:26:39.361: E/MediaPlayer(7057): callback application 08-19 18:26:39.365: E/MediaPlayer(7057): back from callback 08-19 18:26:39.380: I/MediaPlayer(7057): Info (1,44) 08-19 18:26:45.661: E/MediaPlayer(7057): message received msg=200, ext1=1, ext2=44 08-19 18:26:45.661: W/MediaPlayer(7057): info/warning (1, 44) 08-19 18:26:45.661: E/MediaPlayer(7057): callback application 08-19 18:26:45.661: E/MediaPlayer(7057): back from callback 08-19 18:26:45.661: E/MediaPlayer(7057): message received msg=1, ext1=0, ext2=0 08-19 18:26:45.661: E/MediaPlayer(7057): callback application 08-19 18:26:45.661: E/MediaPlayer(7057): back from callback 08-19 18:26:45.708: I/MediaPlayer(7057): Info (1,44) 08-19 18:26:45.779: W/IMediaDeathNotifier(7057): media server died 08-19 18:26:45.779: E/MediaPlayer(7057): message received msg=100, ext1=100, ext2=0 08-19 18:26:45.779: E/MediaPlayer(7057): error (100, 0) 08-19 18:26:45.779: E/MediaPlayer(7057): callback application 08-19 18:26:45.779: E/MediaPlayer(7057): back from callback 08-19 18:26:45.779: E/MediaPlayer(7057): message received msg=100, ext1=100, ext2=0 08-19 18:26:45.779: E/MediaPlayer(7057): error (100, 0) 08-19 18:26:45.779: E/MediaPlayer(7057): callback application 08-19 18:26:45.779: E/MediaPlayer(7057): back from callback 08-19 18:26:45.779: W/Camera(7057): Camera server died! 08-19 18:26:45.786: E/MediaPlayer(7057): Error (100,0) 08-19 18:26:45.790: E/MediaPlayer(7057): Error (100,0)