fix sharing of article videos; do not crash if prepareasync has already been called

This commit is contained in:
Andrew Dolgov 2015-08-18 19:35:38 +03:00
parent 792f7cc722
commit 8e53a7aa88

View File

@ -143,7 +143,11 @@ public class VideoPlayerActivity extends CommonActivity {
@Override @Override
public void surfaceCreated(SurfaceHolder holder) { public void surfaceCreated(SurfaceHolder holder) {
mediaPlayer.setDisplay(holder); mediaPlayer.setDisplay(holder);
mediaPlayer.prepareAsync(); try {
mediaPlayer.prepareAsync();
} catch (IllegalStateException e) {
e.printStackTrace();
}
mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override @Override
public void onPrepared(MediaPlayer mp) { public void onPrepared(MediaPlayer mp) {
@ -238,6 +242,7 @@ public class VideoPlayerActivity extends CommonActivity {
if (m_streamUri != null) { if (m_streamUri != null) {
Intent intent = new Intent(Intent.ACTION_SEND); Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT, m_streamUri); intent.putExtra(Intent.EXTRA_SUBJECT, m_streamUri);
intent.putExtra(Intent.EXTRA_TEXT, m_streamUri); intent.putExtra(Intent.EXTRA_TEXT, m_streamUri);