File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
app/src/main/java/github/kairusds/libvlcandroidtest Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -146,6 +146,7 @@ protected void onResume() {
146
146
protected void onDestroy (){
147
147
super .onDestroy ();
148
148
destroyVLC ();
149
+ shutdownExecutor ();
149
150
}
150
151
151
152
private void pause (){
@@ -182,6 +183,7 @@ private void setVLCMedia(String path){
182
183
time = event .getTimeChanged ();
183
184
break ;
184
185
case Event .EndReached :
186
+ mediaPlayer .stop ();
185
187
destroyVLC ();
186
188
break ;
187
189
}
@@ -217,8 +219,7 @@ private void showFilePickerDialog(File dir){
217
219
handler .post (() -> {
218
220
if (files == null ){
219
221
toast ("Unable to access directory" );
220
- executor .shutdown ();
221
- executor = null ;
222
+ shutdownExecutor ();
222
223
return ;
223
224
}
224
225
@@ -244,8 +245,7 @@ private void showFilePickerDialog(File dir){
244
245
}else {
245
246
setVLCMedia (filepath );
246
247
dialog .dismiss ();
247
- executor .shutdown ();
248
- executor = null ;
248
+ shutdownExecutor ();
249
249
}
250
250
}
251
251
});
@@ -258,6 +258,13 @@ private void showFilePickerDialog(File dir){
258
258
}
259
259
}
260
260
261
+ private void shutdownExecutor (){
262
+ if (executor != null ){
263
+ executor .shutdown ();
264
+ executor = null ;
265
+ }
266
+ }
267
+
261
268
@ Override
262
269
protected void onActivityResult (int requestCode , int resultCode , Intent data ){
263
270
super .onActivityResult (requestCode , resultCode , data );
@@ -280,7 +287,7 @@ protected void onStop(){ // activity is in the background or minimized
280
287
pause ();
281
288
// mediaPlayer.pause();
282
289
// mediaPlayer.stop();
283
- /// mediaPlayer.detachViews();
290
+ mediaPlayer .detachViews ();
284
291
}
285
292
286
293
}
You can’t perform that action at this time.
0 commit comments