From f2a242918d0e76e00a27fedcd11df17fa4829d8b Mon Sep 17 00:00:00 2001 From: mitch Date: Sat, 23 May 2020 22:37:52 -0400 Subject: [PATCH 01/14] Bugfix for https://github.com/solid-software/flutter_vlc_player/issues/52 Bugfix --- .../software/solid/fluttervlcplayer/FlutterVideoView.java | 4 ++-- example/android/build.gradle | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/android/src/main/java/software/solid/fluttervlcplayer/FlutterVideoView.java b/android/src/main/java/software/solid/fluttervlcplayer/FlutterVideoView.java index 77918b92..56e791a0 100755 --- a/android/src/main/java/software/solid/fluttervlcplayer/FlutterVideoView.java +++ b/android/src/main/java/software/solid/fluttervlcplayer/FlutterVideoView.java @@ -165,7 +165,7 @@ public void onMethodCall(MethodCall methodCall, @NonNull MethodChannel.Result re vout.attachViews(); String initStreamURL = methodCall.argument("url"); - Media media = new Media(libVLC, Uri.parse(Uri.decode(initStreamURL))); + Media media = new Media(libVLC, Uri.parse(initStreamURL)); mediaPlayer.setMedia(media); result.success(null); @@ -178,7 +178,7 @@ public void onMethodCall(MethodCall methodCall, @NonNull MethodChannel.Result re mediaPlayer.stop(); String newURL = methodCall.argument("url"); - Media newMedia = new Media(libVLC, Uri.parse(Uri.decode(newURL))); + Media newMedia = new Media(libVLC, Uri.parse(newURL)); mediaPlayer.setMedia(newMedia); result.success(null); diff --git a/example/android/build.gradle b/example/android/build.gradle index 4874c0a6..91c94778 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.1' + classpath 'com.android.tools.build:gradle:3.6.3' } } From c785f1828caab847096eeec4ecd88b406c18c23d Mon Sep 17 00:00:00 2001 From: mitch Date: Sat, 23 May 2020 22:38:55 -0400 Subject: [PATCH 02/14] spec bump --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 92ded1c0..9a28f6db 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.0 +version: 3.0.1 homepage: https://github.com/solid-software/flutter_vlc_player environment: From c5629d9895293764f52ccd6551f9648efa887426 Mon Sep 17 00:00:00 2001 From: mitch Date: Sun, 24 May 2020 11:51:02 -0400 Subject: [PATCH 03/14] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 659dd630..7d11ad3b 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.0.1 +* Fix a bug on Android with URL parsing. See (https://github.com/solid-software/flutter_vlc_player/issues/52), +credits to pharshdev (https://github.com/pharshdev) and Mitch Ross (https://github.com/mitchross) + ## 3.0.0 * Migrated to Swift, thanks to Mitch Ross (https://github.com/mitchross), Amadeu Cavalcante (https://github.com/amadeu01) and pharshdev (https://github.com/pharshdev). From 9aac8d954d0e2df19d17a92b0e879519f5a966ea Mon Sep 17 00:00:00 2001 From: mitch Date: Fri, 29 May 2020 12:13:09 -0400 Subject: [PATCH 04/14] bugfix, podspec update --- ios/flutter_vlc_player.podspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ios/flutter_vlc_player.podspec b/ios/flutter_vlc_player.podspec index 7f225b72..a742a642 100755 --- a/ios/flutter_vlc_player.podspec +++ b/ios/flutter_vlc_player.podspec @@ -4,7 +4,7 @@ # Pod::Spec.new do |s| s.name = 'flutter_vlc_player' - s.version = '3.0.0' + s.version = '3.0.1' s.summary = 'A new flutter plugin project.' s.description = <<-DESC A VLC-powered alternative to Flutter video_player. Supports multiple players on one screen. @@ -16,7 +16,7 @@ Pod::Spec.new do |s| s.source_files = 'Classes/**/*' s.dependency 'Flutter' s.platform = :ios, '9.0' - s.dependency 'MobileVLCKit', '~> 3.3.11' + s.dependency 'MobileVLCKit', '~> 3.3.12' s.static_framework = true # Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported. From c1ab9a4070e6c1990ec831c4deb10db7b2465120 Mon Sep 17 00:00:00 2001 From: mitch Date: Fri, 29 May 2020 12:53:22 -0400 Subject: [PATCH 05/14] Changelog update --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d11ad3b..eae06f7d 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.0.1 +* 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 * Fix a bug on Android with URL parsing. See (https://github.com/solid-software/flutter_vlc_player/issues/52), credits to pharshdev (https://github.com/pharshdev) and Mitch Ross (https://github.com/mitchross) From 6b07983e909b8127551ff2f928612b2ebd310b24 Mon Sep 17 00:00:00 2001 From: mitch Date: Fri, 29 May 2020 13:02:57 -0400 Subject: [PATCH 06/14] Updates version --- ios/flutter_vlc_player.podspec | 2 +- pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ios/flutter_vlc_player.podspec b/ios/flutter_vlc_player.podspec index a742a642..3d23dac3 100755 --- a/ios/flutter_vlc_player.podspec +++ b/ios/flutter_vlc_player.podspec @@ -4,7 +4,7 @@ # Pod::Spec.new do |s| s.name = 'flutter_vlc_player' - s.version = '3.0.1' + s.version = '3.0.2' s.summary = 'A new flutter plugin project.' s.description = <<-DESC A VLC-powered alternative to Flutter video_player. Supports multiple players on one screen. diff --git a/pubspec.yaml b/pubspec.yaml index 9a28f6db..8990e490 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.1 +version: 3.0.2 homepage: https://github.com/solid-software/flutter_vlc_player environment: From f9bd87d4e5cb520be07ddb6db3bb0cae25263d04 Mon Sep 17 00:00:00 2001 From: mitch ross Date: Tue, 7 Jul 2020 10:21:28 -0400 Subject: [PATCH 07/14] Create Video Seek Example --- example/android/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 4 +- example/lib/main.dart | 60 ++++++++++++++----- example/pubspec.yaml | 2 +- 4 files changed, 48 insertions(+), 20 deletions(-) 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/lib/main.dart b/example/lib/main.dart index 208f588c..f90850d5 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,26 @@ 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(); + print('set state: $sliderValue'); + }); + print('set time: $sliderValue'); + //conver 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 +163,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: From 48db45c56397298db6cbaebce240cce7e0656f54 Mon Sep 17 00:00:00 2001 From: mitch Date: Tue, 7 Jul 2020 11:59:49 -0400 Subject: [PATCH 08/14] Fix seek time on iOS. Add Seekbar to demo app. --- CHANGELOG.md | 4 ++++ example/ios/Flutter/.last_build_id | 2 +- ios/Classes/SwiftFlutterVlcPlayerPlugin.swift | 7 +++++-- pubspec.yaml | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9e4a325..ee0ce971 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 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), credits to Mitch Ross (https://github.com/mitchross) 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/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: From 29ef030f4ffea652d49237ce2a1f8ed65cf103c9 Mon Sep 17 00:00:00 2001 From: mitch ross Date: Wed, 8 Jul 2020 17:16:51 -0400 Subject: [PATCH 09/14] PR comments --- CHANGELOG.md | 4 ++-- example/lib/main.dart | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee0ce971..53a9e571 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +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. +* 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/lib/main.dart b/example/lib/main.dart index f90850d5..bf5646a1 100755 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -119,10 +119,8 @@ class MyAppScaffoldState extends State { onChanged: (progress) { setState(() { sliderValue = progress.floor().toDouble(); - print('set state: $sliderValue'); }); - print('set time: $sliderValue'); - //conver to Milliseconds since VLC requires MS to set time + //convert to Milliseconds since VLC requires MS to set time _videoViewController2.setTime(sliderValue.toInt() * 1000); }, ), From 64f5adca07c587308fc9c41e5ea2de687a945c9e Mon Sep 17 00:00:00 2001 From: mitch ross Date: Fri, 31 Jul 2020 15:38:54 -0400 Subject: [PATCH 10/14] volume working on android volume working on android --- .../fluttervlcplayer/FlutterVideoView.java | 9 +++++++++ example/lib/main.dart | 19 +++++++++++++++++-- lib/flutter_vlc_player.dart | 4 ++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/software/solid/fluttervlcplayer/FlutterVideoView.java b/android/src/main/java/software/solid/fluttervlcplayer/FlutterVideoView.java index 3f3e6d91..9ef67ada 100755 --- a/android/src/main/java/software/solid/fluttervlcplayer/FlutterVideoView.java +++ b/android/src/main/java/software/solid/fluttervlcplayer/FlutterVideoView.java @@ -243,6 +243,15 @@ public void onMethodCall(MethodCall methodCall, @NonNull MethodChannel.Result re result.success(null); break; + + case "setVolume": + + int volume = Integer.parseInt((String) methodCall.argument("volume")); + mediaPlayer.setVolume(volume); + result.success(null); + break; + + } } diff --git a/example/lib/main.dart b/example/lib/main.dart index 25e13e89..0f9f0274 100755 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -31,6 +31,7 @@ class MyAppScaffoldState extends State { bool isPlaying = true; double sliderValue = 0.0; double currentPlayerTime = 0; + double volumeValue = 100; @override void initState() { @@ -82,7 +83,7 @@ class MyAppScaffoldState extends State { child: new VlcPlayer( aspectRatio: 16 / 9, url: - "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4", + "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4", controller: _videoViewController, // Play with vlc options options: [ @@ -91,7 +92,8 @@ class MyAppScaffoldState extends State { '--no-skip-frames', '--rtsp-tcp' ], - hwAcc: HwAcc.DISABLED, // or {HwAcc.AUTO, HwAcc.DECODING, HwAcc.FULL} + hwAcc: HwAcc + .DISABLED, // or {HwAcc.AUTO, HwAcc.DECODING, HwAcc.FULL} placeholder: Container( height: 250.0, child: Row( @@ -117,6 +119,7 @@ class MyAppScaffoldState extends State { ), ), ), + Text("Seek"), Slider( activeColor: Colors.white, value: sliderValue, @@ -135,6 +138,18 @@ class MyAppScaffoldState extends State { FlatButton( child: isPlaying ? Icon(Icons.pause) : Icon(Icons.play_arrow), onPressed: () => {playOrPauseVideo()}), + Text("Volume Level"), + Slider( + min: 0, + max: 100, + value: volumeValue, + onChanged: (value) { + setState(() { + volumeValue = value; + }); + _videoViewController2.setVolume(volumeValue.toInt()); + }, + ), FlatButton( child: Text("Change URL"), onPressed: () => _videoViewController.setStreamUrl( diff --git a/lib/flutter_vlc_player.dart b/lib/flutter_vlc_player.dart index 3927d5dd..5eb1dc00 100755 --- a/lib/flutter_vlc_player.dart +++ b/lib/flutter_vlc_player.dart @@ -347,6 +347,10 @@ class VlcPlayerController { await _methodChannel.invokeMethod("setTime", {'time': time.toString()}); } + Future setVolume(int volume) async { + await _methodChannel.invokeMethod("setVolume", {'volume': volume.toString()}); + } + Future setPlaybackSpeed(double speed) async { await _methodChannel .invokeMethod("setPlaybackSpeed", {'speed': speed.toString()}); From 8b84798977a93abdf24a3e1bb7b7ae24247d72df Mon Sep 17 00:00:00 2001 From: mitch ross Date: Fri, 31 Jul 2020 16:07:54 -0400 Subject: [PATCH 11/14] clean up --- .../java/software/solid/fluttervlcplayer/FlutterVideoView.java | 2 +- lib/flutter_vlc_player.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/software/solid/fluttervlcplayer/FlutterVideoView.java b/android/src/main/java/software/solid/fluttervlcplayer/FlutterVideoView.java index 9ef67ada..00302906 100755 --- a/android/src/main/java/software/solid/fluttervlcplayer/FlutterVideoView.java +++ b/android/src/main/java/software/solid/fluttervlcplayer/FlutterVideoView.java @@ -246,7 +246,7 @@ public void onMethodCall(MethodCall methodCall, @NonNull MethodChannel.Result re case "setVolume": - int volume = Integer.parseInt((String) methodCall.argument("volume")); + int volume = methodCall.argument("volume"); mediaPlayer.setVolume(volume); result.success(null); break; diff --git a/lib/flutter_vlc_player.dart b/lib/flutter_vlc_player.dart index 5eb1dc00..48b570c7 100755 --- a/lib/flutter_vlc_player.dart +++ b/lib/flutter_vlc_player.dart @@ -348,7 +348,7 @@ class VlcPlayerController { } Future setVolume(int volume) async { - await _methodChannel.invokeMethod("setVolume", {'volume': volume.toString()}); + await _methodChannel.invokeMethod("setVolume", {'volume': volume}); } Future setPlaybackSpeed(double speed) async { From 0a89b2a775902b3b98aa606d5516f832ce940698 Mon Sep 17 00:00:00 2001 From: mitch ross Date: Fri, 31 Jul 2020 17:35:48 -0400 Subject: [PATCH 12/14] safeguard safeguard --- .../software/solid/fluttervlcplayer/FlutterVideoView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/software/solid/fluttervlcplayer/FlutterVideoView.java b/android/src/main/java/software/solid/fluttervlcplayer/FlutterVideoView.java index 00302906..ba14508b 100755 --- a/android/src/main/java/software/solid/fluttervlcplayer/FlutterVideoView.java +++ b/android/src/main/java/software/solid/fluttervlcplayer/FlutterVideoView.java @@ -245,8 +245,8 @@ public void onMethodCall(MethodCall methodCall, @NonNull MethodChannel.Result re break; case "setVolume": - - int volume = methodCall.argument("volume"); + int volume = 100; + volume = methodCall.argument("volume"); mediaPlayer.setVolume(volume); result.success(null); break; From 14d717a305b269024360bfc61758b5425c9127b9 Mon Sep 17 00:00:00 2001 From: mitch Date: Fri, 31 Jul 2020 17:36:02 -0400 Subject: [PATCH 13/14] add ios volume --- example/ios/Flutter/.last_build_id | 2 +- example/ios/Podfile | 76 ++++--------------- ios/Classes/SwiftFlutterVlcPlayerPlugin.swift | 11 ++- 3 files changed, 24 insertions(+), 65 deletions(-) mode change 100755 => 100644 example/ios/Podfile diff --git a/example/ios/Flutter/.last_build_id b/example/ios/Flutter/.last_build_id index 536e0527..c07d4b8e 100755 --- a/example/ios/Flutter/.last_build_id +++ b/example/ios/Flutter/.last_build_id @@ -1 +1 @@ -f1df2ffda6f2083c9121914530433089 \ No newline at end of file +b51a9eab8a58462f1b870a104119b683 \ No newline at end of file diff --git a/example/ios/Podfile b/example/ios/Podfile old mode 100755 new mode 100644 index d5a6946a..671f7672 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -10,78 +10,32 @@ project 'Runner', { 'Release' => :release, } -def parse_KV_file(file, separator='=') - file_abs_path = File.expand_path(file) - if !File.exists? file_abs_path - return []; +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" end - generated_key_values = {} - skip_line_start_symbols = ["#", "/"] - File.foreach(file_abs_path) do |line| - next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } - plugin = line.split(pattern=separator) - if plugin.length == 2 - podname = plugin[0].strip() - path = plugin[1].strip() - podpath = File.expand_path("#{path}", file_abs_path) - generated_key_values[podname] = podpath - else - puts "Invalid plugin specification: #{line}" - end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches end - generated_key_values + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" end +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + target 'Runner' do use_frameworks! use_modular_headers! - # Flutter Pod - - copied_flutter_dir = File.join(__dir__, 'Flutter') - copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework') - copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec') - unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path) - # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet. - # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration. - # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist. - - generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig') - unless File.exist?(generated_xcode_build_settings_path) - raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first" - end - generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path) - cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR']; - - unless File.exist?(copied_framework_path) - FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir) - end - unless File.exist?(copied_podspec_path) - FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir) - end - end - - # Keep pod path relative so it can be checked into Podfile.lock. - pod 'Flutter', :path => 'Flutter' - - # Plugin Pods - - # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock - # referring to absolute paths on developers' machines. - system('rm -rf .symlinks') - system('mkdir -p .symlinks/plugins') - plugin_pods = parse_KV_file('../.flutter-plugins') - plugin_pods.each do |name, path| - symlink = File.join('.symlinks', 'plugins', name) - File.symlink(path, symlink) - pod name, :path => File.join(symlink, 'ios') - end + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) end post_install do |installer| installer.pods_project.targets.each do |target| - target.build_configurations.each do |config| - config.build_settings['ENABLE_BITCODE'] = 'NO' - end + flutter_additional_ios_build_settings(target) end end diff --git a/ios/Classes/SwiftFlutterVlcPlayerPlugin.swift b/ios/Classes/SwiftFlutterVlcPlayerPlugin.swift index 62a8036b..0218b223 100755 --- a/ios/Classes/SwiftFlutterVlcPlayerPlugin.swift +++ b/ios/Classes/SwiftFlutterVlcPlayerPlugin.swift @@ -138,8 +138,12 @@ public class VLCView: NSObject, FlutterPlatformView { let newTime = NSNumber(value:(setTimeInMillisecondsAsString! as NSString).doubleValue) let time = VLCTime(number: newTime ) self.player.time = time - - + result(nil) + return + + case .setVolume: + let setVolume = arguments["volume"] as? Int32 + self.player.audio.volume = setVolume ?? 100 result(nil) return @@ -202,7 +206,7 @@ class VLCPlayerEventStreamHandler:NSObject, FlutterStreamHandler, VLCMediaPlayer } } - + switch player?.state { case .esAdded, .buffering, .opening: @@ -303,4 +307,5 @@ enum FlutterMethodCallOption :String { case getSnapshot = "getSnapshot" case setPlaybackSpeed = "setPlaybackSpeed" case setTime = "setTime" + case setVolume = "setVolume" } From ec961bb65040d2320b493595988e9ca9ad8ba1af Mon Sep 17 00:00:00 2001 From: mitch ross Date: Fri, 31 Jul 2020 17:37:21 -0400 Subject: [PATCH 14/14] bump readme --- CHANGELOG.md | 4 ++++ pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 893da3bb..8e65b8d2 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.0.5 +* Updates MobileVLC to allow for changing of volume. Example Updated Also. +credits to Mitch Ross (https://github.com/mitchross) + ## 3.0.4 * Updates MobileVLC to allow for options as flags and hardware acceleration/ credits to pharshdev (https://github.com/pharshdev) and Mitch Ross (https://github.com/mitchross) diff --git a/pubspec.yaml b/pubspec.yaml index 7c22b358..a05f45d3 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.4 +version: 3.0.5 homepage: https://github.com/solid-software/flutter_vlc_player environment: