Skip to content

Commit 1cf6ab9

Browse files
authored
Added error handling (#89)
1 parent abea8fa commit 1cf6ab9

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 3.0.6
2+
* Updates MobileVLC to allow for handling of vlc error.
3+
credits to Alireza Setayesh (https://github.com/alr2413)
4+
15
## 3.0.5
26
* Updates MobileVLC to allow for changing of volume. Example Updated Also.
37
credits to Mitch Ross (https://github.com/mitchross)

android/src/main/java/software/solid/fluttervlcplayer/FlutterVideoView.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,9 @@ public void onEvent(MediaPlayer.Event event) {
312312

313313
case MediaPlayer.Event.EncounteredError:
314314
System.err.println("(flutter_vlc_plugin) A VLC error occurred.");
315+
eventSink.error("error", "A VLC error occurred.", null);
316+
break;
317+
315318
case MediaPlayer.Event.Paused:
316319
case MediaPlayer.Event.Stopped:
317320
eventObject.put("name", "buffering");

lib/flutter_vlc_player.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'package:flutter/foundation.dart';
88
import 'package:flutter/rendering.dart';
99
import 'package:flutter/services.dart';
1010

11-
enum PlayingState { STOPPED, BUFFERING, PLAYING }
11+
enum PlayingState { STOPPED, BUFFERING, PLAYING, ERROR }
1212
enum HwAcc { AUTO, DISABLED, DECODING, FULL }
1313

1414
int getHwAcc({@required HwAcc hwAcc}) {
@@ -309,6 +309,9 @@ class VlcPlayerController {
309309
_fireEventHandlers();
310310
break;
311311
}
312+
}).onError((e){
313+
_playingState = PlayingState.ERROR;
314+
_fireEventHandlers();
312315
});
313316

314317
_initialized = true;

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_vlc_player
22
description: A VLC-powered alternative to Flutter's video_player. Supports multiple players on one screen.
3-
version: 3.0.5
3+
version: 3.0.6
44
homepage: https://github.com/solid-software/flutter_vlc_player
55

66
environment:

0 commit comments

Comments
 (0)