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
1 changed files with 6 additions and 1 deletions

View File

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