diff --git a/CHANGELOG.md b/CHANGELOG.md index f9e4a325..53a9e571 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ +## 3.0.3 +* Updates MobileVLC to fix a bug on iOS with Seek Time. See (https://github.com/solid-software/flutter_vlc_player/issues/72). Also adds seek bar to example player for demonstration purposes. +credits to Mitch Ross (https://github.com/mitchross) + ## 3.0.2 -* Updates MobileVLC to fix a bug on ios with HLS Streaming on VLCKit itself. See (https://code.videolan.org/videolan/VLCKit/-/issues/368), +* Updates MobileVLC to fix a bug on iOS with HLS Streaming on VLCKit itself. See (https://code.videolan.org/videolan/VLCKit/-/issues/368), credits to Mitch Ross (https://github.com/mitchross) ## 3.0.1 diff --git a/example/android/build.gradle b/example/android/build.gradle index 91c94778..992f1a99 100755 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -5,7 +5,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.6.3' + classpath 'com.android.tools.build:gradle:4.0.0' } } diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index 534fb274..486181e0 100755 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Mar 11 22:39:55 EDT 2020 +#Mon Jul 06 16:18:01 EDT 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip diff --git a/example/ios/Flutter/.last_build_id b/example/ios/Flutter/.last_build_id index 69faea91..536e0527 100755 --- a/example/ios/Flutter/.last_build_id +++ b/example/ios/Flutter/.last_build_id @@ -1 +1 @@ -9a6723ad18e3f950fccdc81adda11616 \ No newline at end of file +f1df2ffda6f2083c9121914530433089 \ No newline at end of file diff --git a/example/lib/main.dart b/example/lib/main.dart index 208f588c..bf5646a1 100755 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,3 +1,4 @@ +import 'dart:async'; import 'dart:typed_data'; import 'package:flutter/material.dart'; @@ -28,6 +29,8 @@ class MyAppScaffoldState extends State { VlcPlayerController _videoViewController; VlcPlayerController _videoViewController2; bool isPlaying = true; + double sliderValue = 0.0; + double currentPlayerTime = 0; @override void initState() { @@ -45,6 +48,18 @@ class MyAppScaffoldState extends State { setState(() {}); }); + Timer.periodic(Duration(seconds: 1), (Timer timer) { + String state = _videoViewController2.playingState.toString(); + if (this.mounted) { + setState(() { + if (state == "PlayingState.PLAYING" && + sliderValue < _videoViewController2.duration.inSeconds) { + sliderValue = _videoViewController2.position.inSeconds.toDouble(); + } + }); + } + }); + super.initState(); } @@ -94,12 +109,24 @@ class MyAppScaffoldState extends State { ), ), ), - FlatButton( - child: isPlaying ? Icon(Icons.pause) : Icon(Icons.play_arrow) , - onPressed: () => { - playOrPauseVideo() - } + Slider( + activeColor: Colors.white, + value: sliderValue, + min: 0.0, + max: _videoViewController2.duration == null + ? 1.0 + : _videoViewController2.duration.inSeconds.toDouble(), + onChanged: (progress) { + setState(() { + sliderValue = progress.floor().toDouble(); + }); + //convert to Milliseconds since VLC requires MS to set time + _videoViewController2.setTime(sliderValue.toInt() * 1000); + }, ), + FlatButton( + child: isPlaying ? Icon(Icons.pause) : Icon(Icons.play_arrow), + onPressed: () => {playOrPauseVideo()}), FlatButton( child: Text("Change URL"), onPressed: () => _videoViewController.setStreamUrl( @@ -134,20 +161,19 @@ class MyAppScaffoldState extends State { } void playOrPauseVideo() { - String state = _videoViewController.playingState.toString(); - - if ( state == "PlayingState.PLAYING" ){ - _videoViewController.pause(); - setState(() { - isPlaying = false; - }); + String state = _videoViewController2.playingState.toString(); + + if (state == "PlayingState.PLAYING") { + _videoViewController2.pause(); + setState(() { + isPlaying = false; + }); } else { - _videoViewController.play(); - setState(() { + _videoViewController2.play(); + setState(() { isPlaying = true; - }); + }); } - } void _createCameraImage() async { diff --git a/example/pubspec.yaml b/example/pubspec.yaml index fcf9fd92..0e73202a 100755 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -3,7 +3,7 @@ description: Demonstrates how to use the flutter_vlc_player plugin. publish_to: 'none' environment: - sdk: ">=2.0.0-dev.68.0 <3.0.0" + sdk: ">=2.2.0 <3.0.0" dependencies: flutter: diff --git a/ios/Classes/SwiftFlutterVlcPlayerPlugin.swift b/ios/Classes/SwiftFlutterVlcPlayerPlugin.swift index b2a717ba..62a8036b 100755 --- a/ios/Classes/SwiftFlutterVlcPlayerPlugin.swift +++ b/ios/Classes/SwiftFlutterVlcPlayerPlugin.swift @@ -134,9 +134,12 @@ public class VLCView: NSObject, FlutterPlatformView { return case .setTime: - - let time = VLCTime(number: arguments["time"] as? NSNumber) + let setTimeInMillisecondsAsString = arguments["time"] as? String + let newTime = NSNumber(value:(setTimeInMillisecondsAsString! as NSString).doubleValue) + let time = VLCTime(number: newTime ) self.player.time = time + + result(nil) return diff --git a/pubspec.yaml b/pubspec.yaml index 8990e490..9efee0d2 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_vlc_player description: A VLC-powered alternative to Flutter's video_player. Supports multiple players on one screen. -version: 3.0.2 +version: 3.0.3 homepage: https://github.com/solid-software/flutter_vlc_player environment: