2013-04-19 2 views
0

내 응용 프로그램에 splahs 화면이 있으며 해당 활동에 대한 비디오를 재생 중입니다. 그러나 일부 안드로이드 버전 (나는 오래된 것을 의미 함)에서 비디오가 재생되지 않습니다. 내가Videoplayer가 스플 라 화면에서 비디오를 재생하지 않습니다.

여기

것은 내 코드

public void PlayVideo(){ 
    try{    
      videoPlayer.setDataSource(getApplicationContext(), Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.afad_splash_ip4)); 
      videoPlayer.prepare(); 
     } 
     catch (Exception e){ 

     } 
    try { 
      AssetFileDescriptor descriptor = getAssets().openFd("splash.mp4");    
      videoPlayer.reset();   
      videoPlayer.setDataSource(descriptor.getFileDescriptor());    
      videoPlayer.prepare();   
      } 
      catch (Exception ex) 
      { 
       try 
       {     
       Log.v("video ", "catch"); 
       videoPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 
       videoPlayer.setVolume(0f, 0f); 
       videoPlayer.start(); 
       videoPlayer.setLooping(false);     
       videoPlayer.setOnCompletionListener(new OnCompletionListener() { 
       public void onCompletion(MediaPlayer mp) { 
        Intent i = new Intent(VideoSplash.this,ListActivity.class); 
        i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
        startActivity(i); 
        overridePendingTransition(R.anim.slide_in_top,R.anim.slide_out_bottom); 
        finish(); 
        } 
       }); 
       } 
       catch (Exception e) 
       {  //TODO 
        //Burada Video yerine resim koymalısın 
        //Kimi cihazlarda video oynamayabilir 
        Log.v("resim", "catch"); 
        //Thats where i want to put a pic as a backgroun to my SurfaceView. and make it wait 10 secs 
       // videoSurface.setBackgroundDrawable(getResources().getDrawable(R.drawable.son_frame)); 
        } 
       //TODO 
      //Burada Video yerine resim koymalısın 
      //Kimi cihazlarda video oynamayabilir    

      }      


    } 

답변

0

중 일부는이 코드가 당신에게

public class VideoPlayerActivity extends Activity implements OnErrorListener, 
OnPreparedListener { 

LoadAsyncTask video_async_task; 

private VideoView mVideoView 

public void onCreate(Bundle icicle) { 

super.onCreate(icicle); 
setContentView(R.layout.video); 
mVideoView = (VideoView) findViewById(R.id.mysurfaceview); 
mVideoView.setMediaController(myctrl); 


mVideoView.requestFocus(); 

video_async_task = new LoadAsyncTask(); 
video_async_task.execute(); 

} 

private class LoadAsyncTask extends AsyncTask<Void, Void, Void> { 

protected Void doInBackground(Void... params) { 

mVideoView.setVideoURI(Uri.parse(path)); 

} 


} 
도움이 될 것입니다보십시오입니다 .. 무엇을 잘 모릅니다
관련 문제