Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: slider pos after seek and fullscreen toggle #268

Merged
merged 1 commit into from
Jul 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true
#android.enableR8=true
2 changes: 2 additions & 0 deletions example/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
rootProject.name = 'fijkplayer-android'

include ':app'

def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
Expand Down
9 changes: 8 additions & 1 deletion example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
PODS:
- BIJKPlayer (0.7.6)
- fijkplayer (0.8.4):
- BIJKPlayer (~> 0.7.6)
- Flutter
- Flutter (1.0.0)
- shared_preferences (0.0.1):
Expand All @@ -16,6 +18,10 @@ DEPENDENCIES:
- shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`)
- shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`)

SPEC REPOS:
trunk:
- BIJKPlayer

EXTERNAL SOURCES:
fijkplayer:
:path: ".symlinks/plugins/fijkplayer/ios"
Expand All @@ -29,7 +35,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/shared_preferences_web/ios"

SPEC CHECKSUMS:
fijkplayer: a41c440645ea4c14c971de7f4870200910086497
BIJKPlayer: 5f6ab4b6cafcff21e0264bdcd006a81c42411a5d
fijkplayer: d587b7aefa53a89f4c38db4cfb631c3f2ce4a3d3
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d
shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087
Expand Down
9 changes: 4 additions & 5 deletions lib/core/fijkplayer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -557,11 +557,10 @@ class FijkPlayer extends ChangeNotifier implements ValueListenable<FijkValue> {
}
break;
case 'size_changed':
int width = map['width'];
int height = map['height'];
double width = map['width'].toDouble();
double height = map['height'].toDouble();
FijkLog.i("$this size changed ($width, $height)");
_setValue(
value.copyWith(size: Size(width.toDouble(), height.toDouble())));
_setValue(value.copyWith(size: Size(width, height)));
break;
case 'seek_complete':
_seeking = false;
Expand All @@ -574,7 +573,7 @@ class FijkPlayer extends ChangeNotifier implements ValueListenable<FijkValue> {
void _errorListener(Object obj) {
final PlatformException e = obj;
FijkException exception = FijkException.fromPlatformException(e);
FijkLog.e("$this errorListerner: $exception");
FijkLog.e("$this errorListener: $exception");
_setValue(value.copyWith(exception: exception));
}

Expand Down
1 change: 1 addition & 0 deletions lib/core/fijkvalue.dart
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ class FijkException implements Exception {
class FijkData {
static String _fijkViewPanelVolume = "__fijkview_panel_init_volume";
static String _fijkViewPanelBrightness = "__fijkview_panel_init_brightness";
static String _fijkViewPanelSeekto = "__fijkview_panel_sekto_position";

final Map<String, dynamic> _data = HashMap();

Expand Down
14 changes: 14 additions & 0 deletions lib/ui/panel2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ class __FijkPanel2State extends State<_FijkPanel2> {
ImageProvider _imageProvider;
Timer _snapshotTimer;

// Is it needed to clear seek data in FijkData (widget.data)
bool _needClearSeekData = true;

static const FijkSliderColors sliderColors = FijkSliderColors(
cursorColor: Color.fromARGB(240, 250, 100, 10),
playedColor: Color.fromARGB(200, 240, 90, 50),
Expand All @@ -129,8 +132,17 @@ class __FijkPanel2State extends State<_FijkPanel2> {
} else {
_currentPos = v;
}
if (_needClearSeekData) {
widget.data.clearValue(FijkData._fijkViewPanelSeekto);
}
_needClearSeekData = false;
});

if (widget.data.contains(FijkData._fijkViewPanelSeekto)) {
var pos = widget.data.getValue(FijkData._fijkViewPanelSeekto) as double;
_currentPos = Duration(milliseconds: pos.toInt());
}

_bufferPosSubs = player.onBufferPosUpdate.listen((v) {
if (_hideStuff == false) {
setState(() {
Expand Down Expand Up @@ -346,6 +358,8 @@ class __FijkPanel2State extends State<_FijkPanel2> {
setState(() {
player.seekTo(v.toInt());
_currentPos = Duration(milliseconds: _seekPos.toInt());
widget.data.setValue(FijkData._fijkViewPanelSeekto, _seekPos);
_needClearSeekData = true;
_seekPos = -1.0;
});
},
Expand Down