vitamio中的错误4.2.1在状态4中调用的玩家停止

时间:2014-05-18 14:05:38

标签: android vitamio

05-18 17:04:51.385: E/Vitamio[4.2.1][Player](7555): stop called in state 4
05-18 17:04:51.385: D/dalvikvm(7555): threadid=21: thread exiting, not yet detached (count=0)
05-18 17:04:51.385: D/dalvikvm(7555): threadid=21: thread exiting, not yet detached (count=1)
05-18 17:04:51.385: E/dalvikvm(7555): threadid=21: native thread exited without detaching
05-18 17:04:51.385: E/dalvikvm(7555): VM aborting
05-18 17:04:51.390: A/libc(7555): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 8108 (helnix.signage)

运行此代码时,我在vitamio中遇到此异常

    private void playVideo(String path) {
    doCleanUp();
    try {
        if (path == "") {
            // Tell the user to provide a media file URL.
            Toast.makeText(
                    this,
                    "Please edit Your Path,"
                            + " and set the path variable to your media file URL.",
                    Toast.LENGTH_LONG).show();
            return;
        } else {
            // Create a new media player and set the listeners
            mMediaPlayer = new MediaPlayer(this);
            mMediaPlayer.setDataSource(path);
            mMediaPlayer.setDisplay(holder);
            mMediaPlayer.prepareAsync();
            mMediaPlayer.setOnBufferingUpdateListener(this);
            mMediaPlayer.setOnCompletionListener(this);
            mMediaPlayer.setOnPreparedListener(this);
            mMediaPlayer.setOnVideoSizeChangedListener(this);
            setVolumeControlStream(AudioManager.STREAM_MUSIC);
        }
    } catch (Exception e) {
        Log.i(TAG, "PlayVideoException");
        Log.e(TAG, "error: " + e.getMessage(), e);
        // Toast.makeText(this, "sorry", Toast.LENGTH_LONG).show();
    }
}

public void onBufferingUpdate(MediaPlayer arg0, int percent) {
    // Log.d(TAG, "onBufferingUpdate percent:" + percent);
}

public long getCurrentPosition() {
    return mMediaPlayer.getCurrentPosition();
}

public long getDuration() {
    return mMediaPlayer.getDuration();
}

public boolean onError(MediaPlayer mp, int whatError, int extra) {
    if (whatError == MediaPlayer.MEDIA_ERROR_IO) {
        Log.v(TAG, "Media Error, Server Died " + extra);
    } else if (whatError == MediaPlayer.MEDIA_ERROR_UNKNOWN) {
        Log.v(TAG, "Media Error, Error Unknown " + extra);
    }
    isVideoError = true;
    return false;
}

public void onCompletion(MediaPlayer arg0) {
    onComplete = true;
    Log.d(TAG, "onCompletion called");
    Log.i(TAG, "onCompletion called");
}

public void onVideoSizeChanged(MediaPlayer mp, int width, int height) {
    Log.v(TAG, "onVideoSizeChanged called");
    if (width == 0 || height == 0) {
        Log.e(TAG, "invalid video width(" + width + ") or height(" + height
                + ")");
        return;
    }
    mIsVideoSizeKnown = true;
    mVideoWidth = width;
    mVideoHeight = height;
    if (mIsVideoReadyToBePlayed && mIsVideoSizeKnown) {
        startVideoPlayback();
    }
}

public void onPrepared(MediaPlayer mediaplayer) {
    Log.d(TAG, "onPrepared called");
    mIsVideoReadyToBePlayed = true;
    if (mIsVideoReadyToBePlayed && mIsVideoSizeKnown) {
        startVideoPlayback();
    }
}

public void surfaceChanged(SurfaceHolder surfaceholder, int i, int j, int k) {
    Log.d(TAG, "surfaceChanged called");

}

public void surfaceDestroyed(SurfaceHolder surfaceholder) {
    Log.d(TAG, "surfaceDestroyed called");
}

public void surfaceCreated(SurfaceHolder holder) {
    Log.d(TAG, "surfaceCreated called");
    try {
        doTimerTaskforVideo();
    } catch (Exception e) {
        Log.d(TAG, "surfaceCreated created Exception");
    }
}

@Override
protected void onPause() {
    super.onPause();
    releaseMediaPlayer();
    doCleanUp();
}

@Override
protected void onDestroy() {
    super.onDestroy();
    TRS.RssTimer.cancel();
    VideoTimer.cancel();
    XMLTimer.cancel();
    surfaceDestroyed(holder);
    releaseMediaPlayer();
    mMediaPlayer = null;
    doCleanUp();
}

private void releaseMediaPlayer() {
    if (mMediaPlayer != null) {
        mMediaPlayer.release();
        mMediaPlayer = null;
    }
}

private void doCleanUp() {
    mVideoWidth = 0;
    mVideoHeight = 0;
    mIsVideoReadyToBePlayed = false;
    mIsVideoSizeKnown = false;
}

private void startVideoPlayback() {
    Log.v(TAG, "startVideoPlayback");
    holder.setFixedSize(mVideoWidth, mVideoHeight);
    mMediaPlayer.start();
}

任何人都可以知道这个例外是什么意思吗?

如何确定导致该异常的线程以及如何防止此异常

提前致谢

0 个答案:

没有答案