<p dir="ltr">Good point, I missed your mail sorry. I'll change it.<br>
</p>
<br><div class="gmail_quote">Le mar. 19 mai 2015 07:42, Steve Lhomme <<a href="mailto:robux4@gmail.com">robux4@gmail.com</a>> a écrit :<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, May 18, 2015 at 5:25 PM, Geoffrey Métais<br>
<<a href="mailto:geoffrey.metais@gmail.com" target="_blank">geoffrey.metais@gmail.com</a>> wrote:<br>
> ---<br>
> .../vlc/gui/video/VideoPlayerActivity.java | 44 ++++++++++++++++------<br>
> 1 file changed, 32 insertions(+), 12 deletions(-)<br>
><br>
> diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java<br>
> index f4fa0f8..b3bc9c9 100644<br>
> --- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java<br>
> +++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java<br>
> @@ -43,7 +43,6 @@ import android.media.MediaRouter;<br>
> import android.net.Uri;<br>
> import android.os.Build;<br>
> import android.os.Bundle;<br>
> -import android.os.Environment;<br>
> import android.os.Handler;<br>
> import android.os.Looper;<br>
> import android.os.Message;<br>
> @@ -149,6 +148,14 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVideoPlay<br>
> public final static String PLAY_EXTRA_FROM_START = "from_start";<br>
> public final static String PLAY_EXTRA_OPENED_POSITION = "opened_position";<br>
><br>
> + public final static String ACTION_RESULT = "org.videolan.vlc.player.result";<br>
> + public final static String EXTRA_POSITION = "extra_position";<br>
> + public final static String EXTRA_DURATION = "extra_duration";<br>
> + public final static int RESULT_CONNECTION_FAILED = RESULT_FIRST_USER + 1;<br>
> + public final static int RESULT_PLAYBACK_ERROR = RESULT_FIRST_USER + 2;<br>
> + public final static int RESULT_HARDWARE_ACCELERATION_ERROR = RESULT_FIRST_USER + 3;<br>
> + public final static int RESULT_VIDEO_TRACK_LOST = RESULT_FIRST_USER + 4;<br>
> +<br>
> private SurfaceView mSurfaceView;<br>
> private SurfaceView mSubtitlesSurfaceView;<br>
> private SurfaceHolder mSurfaceHolder;<br>
> @@ -325,7 +332,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVideoPlay<br>
> super.onCreate(savedInstanceState);<br>
><br>
> if (!VLCInstance.testCompatibleCPU(this)) {<br>
> - finish();<br>
> + exit(RESULT_CANCELED);<br>
> return;<br>
> }<br>
><br>
> @@ -883,11 +890,24 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVideoPlay<br>
> mBattery.setText(String.format("%d%%", batteryLevel));<br>
> }<br>
> else if (action.equalsIgnoreCase(VLCApplication.SLEEP_INTENT)) {<br>
> - finish();<br>
> + exit();<br>
> }<br>
> }<br>
> };<br>
><br>
> + private void exit(int resultCode){<br>
> + Intent resultIntent = new Intent(ACTION_RESULT);<br>
> + resultIntent.setData(Uri.parse(mLocation));<br>
> + resultIntent.putExtra(EXTRA_POSITION, mLibVLC.getTime());<br>
> + resultIntent.putExtra(EXTRA_DURATION, mLibVLC.getLength());<br>
> + setResult(resultCode, resultIntent);<br>
> + finish();<br>
> + }<br>
> +<br>
> + private void exit() {<br>
<br>
exitOK() ? Parce que sinon les appels me font penser a System.exit()<br>
<br>
> + exit(RESULT_OK);<br>
> + }<br>
> +<br>
> @TargetApi(21)<br>
> private void registerV21() {<br>
> final IntentFilter intentFilter = new IntentFilter(AudioManager.ACTION_HDMI_AUDIO_PLUG);<br>
> @@ -971,7 +991,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVideoPlay<br>
> } else if (BuildConfig.tv && mShowing && !mIsLocked) {<br>
> hideOverlay(true);<br>
> } else<br>
> - super.onBackPressed();<br>
> + exit();<br>
> }<br>
><br>
> @Override<br>
> @@ -1028,7 +1048,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVideoPlay<br>
> return true;<br>
> case KeyEvent.KEYCODE_S:<br>
> case KeyEvent.KEYCODE_MEDIA_STOP:<br>
> - finish();<br>
> + exit();<br>
> return true;<br>
> case KeyEvent.KEYCODE_DPAD_UP:<br>
> case KeyEvent.KEYCODE_DPAD_DOWN:<br>
> @@ -1545,7 +1565,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVideoPlay<br>
> activity.startPlayback();<br>
> break;<br>
> case AUDIO_SERVICE_CONNECTION_FAILED:<br>
> - activity.finish();<br>
> + activity.exit(RESULT_CONNECTION_FAILED);<br>
> break;<br>
> case RESET_BACK_LOCK:<br>
> activity.mLockBackButton = true;<br>
> @@ -1584,7 +1604,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVideoPlay<br>
> } else {<br>
> /* Exit player when reaching the end */<br>
> mEndReached = true;<br>
> - finish();<br>
> + exit();<br>
> }<br>
> }<br>
><br>
> @@ -1596,7 +1616,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVideoPlay<br>
> .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {<br>
> @Override<br>
> public void onClick(DialogInterface dialog, int id) {<br>
> - finish();<br>
> + exit(RESULT_PLAYBACK_ERROR);<br>
> }<br>
> })<br>
> .setTitle(R.string.encountered_error_title)<br>
> @@ -1628,13 +1648,13 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVideoPlay<br>
> .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {<br>
> @Override<br>
> public void onClick(DialogInterface dialog, int id) {<br>
> - finish();<br>
> + exit(RESULT_HARDWARE_ACCELERATION_ERROR);<br>
> }<br>
> })<br>
> .setOnCancelListener(new DialogInterface.OnCancelListener() {<br>
> @Override<br>
> public void onCancel(DialogInterface dialog) {<br>
> - finish();<br>
> + exit(RESULT_HARDWARE_ACCELERATION_ERROR);<br>
> }<br>
> })<br>
> .setTitle(R.string.hardware_acceleration_error_title)<br>
> @@ -1649,7 +1669,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVideoPlay<br>
> /* Video track lost, open in audio mode */<br>
> Log.i(TAG, "Video track lost, switching to audio");<br>
> mSwitchingView = true;<br>
> - finish();<br>
> + exit(RESULT_VIDEO_TRACK_LOST);<br>
> }<br>
> }<br>
><br>
> @@ -1671,7 +1691,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVideoPlay<br>
> }<br>
> startActivity(i);<br>
> }<br>
> - finish();<br>
> + exit();<br>
> }<br>
><br>
> @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)<br>
> --<br>
> 2.1.4<br>
><br>
> _______________________________________________<br>
> Android mailing list<br>
> <a href="mailto:Android@videolan.org" target="_blank">Android@videolan.org</a><br>
> <a href="https://mailman.videolan.org/listinfo/android" target="_blank">https://mailman.videolan.org/listinfo/android</a><br>
_______________________________________________<br>
Android mailing list<br>
<a href="mailto:Android@videolan.org" target="_blank">Android@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/android" target="_blank">https://mailman.videolan.org/listinfo/android</a><br>
</blockquote></div>