【问题标题】:Android Media Player Error (100,0)Android 媒体播放器错误 (100,0)
【发布时间】:2012-08-12 17:21:04
【问题描述】:

我已经阅读了网上给出的所有错误代码。

错误指定:

常量 PVMFStatus PVMFInfoLast = 100; "范围结束的占位符"

但我无法处理此错误,感谢您的帮助。

【问题讨论】:

    标签: android android-mediaplayer android-video-player


    【解决方案1】:

    我在 Android 1.5 上遇到过这个问题。

    mMP = new MediaPlayer();
    mMP.setOnCompletionListener(new CompletionListener());
    mMP.setOnErrorListener(new ErrorListener());    
    final FileInputStream fileInStream = new FileInputStream(mFileName);    
    mMP.setDataSource(fileInStream.getFD());        
    mMP.prepare();
    mMP.play();
    
    01-14 01:57:26.248: W/MediaPlayer(1971): MediaPlayer server died!
    01-14 01:57:26.258: E/MediaPlayer(1971): error (100, 0)
    01-14 01:57:26.258: E/MediaPlayer(1971): Error (100,0)
    

    当 mp3 文件的持续时间少于 1 秒时会发生这种情况。这是一个android.media.MediaPlayer 错误。

    解决办法是让 mp3 文件的时长超过 1 秒。

    【讨论】:

      【解决方案2】:

      在你的类中实现 OnErrorListener。

      在类体内写

      video_view.setOnErrorListener(this);
      

      然后用这个方法覆盖 OnError(MediaPlayer mp , int what , int extra) 方法

      @Override
      public boolean onError(MediaPlayer mp, int what, int extra) 
      {
          if (what == 100)
          {
              video_view.stopPlayback();
              Intent inn = new Intent(HelloInterruptVideoStream.this,TabAct.class);
              startActivity(inn);
          }
          else if (what == 1)
          {
              pb2.setVisibility(View.GONE);
              Log.i("My Error ", "handled here");
              video_view.stopPlayback();
              Intent inn = new Intent(HelloInterruptVideoStream.this,TabAct.class);
              startActivity(inn);
          }
          else if(what == 800)
          {
              video_view.stopPlayback();
              Intent inn = new Intent(HelloInterruptVideoStream.this,TabAct.class);
              startActivity(inn);
          }
          else if (what == 701)
          {
              video_view.stopPlayback();
              Intent inn = new Intent(HelloInterruptVideoStream.this,TabAct.class);
              startActivity(inn);
          }
          else if(what == 700)
          {
              video_view.stopPlayback();
      
              Toast.makeText(getApplicationContext(), "Bad Media format ", Toast.LENGTH_SHORT).show();
              Intent inn = new Intent(HelloInterruptVideoStream.this,TabAct.class);
              startActivity(inn);
          }
      
          else if (what == -38)
          {
              video_view.stopPlayback();
              Intent inn = new Intent(HelloInterruptVideoStream.this,TabAct.class);
              startActivity(inn);
          }
          return false;
      }
      

      【讨论】:

      • 好的旧开关/机箱和constants 发生了什么?
      • 是的,你是对的,只是它没有出现在中间,我赶紧开始做......哎呀,但它有效:)..
      • 什么是 pb2,为什么你只在 errorcode == 1 时才改变它的可见性?
      • 带字符串的开关/大小写不适用于 android,所以我也更喜欢使用这个 ^^
      • @D4rWiNS 什么变量是 int
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-27
      相关资源
      最近更新 更多