Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
afollestad committed May 13, 2016
1 parent b1efd11 commit 23e7e55
Showing 1 changed file with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -470,24 +470,36 @@ public void reset() {

@Override
public void release() {
if (mPlayer == null) return;
mIsPrepared = false;

try {
mPlayer.release();
} catch (Throwable ignored) {
if (mPlayer != null) {
try {
mPlayer.release();
} catch (Throwable ignored) {
}
mPlayer = null;
}
mPlayer = null;

if (mHandler != null) {
mHandler.removeCallbacks(mUpdateCounters);
mHandler = null;
}

if (mTextureView != null) {
try {
mTextureView.getSurfaceTexture().release();
} catch (Throwable ignored) {
}
}

if (mSurface != null) {
mSurface.release();
try {
mSurface.release();
} catch (Throwable ignored) {
}
mSurface = null;
}

LOG("Released player and Handler");
}

Expand Down Expand Up @@ -752,18 +764,8 @@ public void onStopTrackingTouch(SeekBar seekBar) {
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();

LOG("Detached from window");
if (mPlayer != null) {
stop();
release();
}

mTextureView = null;
if (mSurface != null) {
mSurface.release();
mSurface = null;
}
release();

mSeeker = null;
mLabelPosition = null;
Expand Down

0 comments on commit 23e7e55

Please sign in to comment.