From a4474dcf5e14fbd74db8b4f19223b9bfa40ed5f5 Mon Sep 17 00:00:00 2001 From: Gustl22 Date: Wed, 5 Oct 2022 08:05:22 +0200 Subject: [PATCH] fix(darwin): infinity / nan on getDuration (#1298) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I decided to do a separate PR, as it doesn't really belong to the tests in #1284. Avoid getting error when calling getDuration on darwin, when getting back infinity or NaN values. --- .../audioplayers/example/ios/Podfile.lock | 55 ++++++++++++++++++- .../ios/Runner.xcodeproj/project.pbxproj | 3 +- .../audioplayers/example/macos/Podfile.lock | 2 +- .../darwin/Classes/Utils.swift | 1 + 4 files changed, 57 insertions(+), 4 deletions(-) diff --git a/packages/audioplayers/example/ios/Podfile.lock b/packages/audioplayers/example/ios/Podfile.lock index 989e9fda3..ae72728a4 100644 --- a/packages/audioplayers/example/ios/Podfile.lock +++ b/packages/audioplayers/example/ios/Podfile.lock @@ -1,21 +1,69 @@ PODS: - audioplayers_darwin (0.0.1): - Flutter + - DKImagePickerController/Core (4.3.4): + - DKImagePickerController/ImageDataManager + - DKImagePickerController/Resource + - DKImagePickerController/ImageDataManager (4.3.4) + - DKImagePickerController/PhotoGallery (4.3.4): + - DKImagePickerController/Core + - DKPhotoGallery + - DKImagePickerController/Resource (4.3.4) + - DKPhotoGallery (0.0.17): + - DKPhotoGallery/Core (= 0.0.17) + - DKPhotoGallery/Model (= 0.0.17) + - DKPhotoGallery/Preview (= 0.0.17) + - DKPhotoGallery/Resource (= 0.0.17) + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Core (0.0.17): + - DKPhotoGallery/Model + - DKPhotoGallery/Preview + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Model (0.0.17): + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Preview (0.0.17): + - DKPhotoGallery/Model + - DKPhotoGallery/Resource + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Resource (0.0.17): + - SDWebImage + - SwiftyGif + - file_picker (0.0.1): + - DKImagePickerController/PhotoGallery + - Flutter - Flutter (1.0.0) - integration_test (0.0.1): - Flutter - path_provider_ios (0.0.1): - Flutter + - SDWebImage (5.13.4): + - SDWebImage/Core (= 5.13.4) + - SDWebImage/Core (5.13.4) + - SwiftyGif (5.4.3) DEPENDENCIES: - audioplayers_darwin (from `.symlinks/plugins/audioplayers_darwin/ios`) + - file_picker (from `.symlinks/plugins/file_picker/ios`) - Flutter (from `Flutter`) - integration_test (from `.symlinks/plugins/integration_test/ios`) - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`) +SPEC REPOS: + trunk: + - DKImagePickerController + - DKPhotoGallery + - SDWebImage + - SwiftyGif + EXTERNAL SOURCES: audioplayers_darwin: :path: ".symlinks/plugins/audioplayers_darwin/ios" + file_picker: + :path: ".symlinks/plugins/file_picker/ios" Flutter: :path: Flutter integration_test: @@ -24,10 +72,15 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/path_provider_ios/ios" SPEC CHECKSUMS: - audioplayers_darwin: 387322cb364026a1782298c982693b1b6aa9fa1b + audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40 + DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac + DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 + file_picker: 817ab1d8cd2da9d2da412a417162deee3500fc95 Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 integration_test: a1e7d09bd98eca2fc37aefd79d4f41ad37bdbbe5 path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02 + SDWebImage: e5cc87bf736e60f49592f307bdf9e157189298a3 + SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780 PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 diff --git a/packages/audioplayers/example/ios/Runner.xcodeproj/project.pbxproj b/packages/audioplayers/example/ios/Runner.xcodeproj/project.pbxproj index 8793ce386..b5c9c00de 100644 --- a/packages/audioplayers/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/audioplayers/example/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 51; objects = { /* Begin PBXBuildFile section */ @@ -68,7 +68,6 @@ C3DA4DB9E96E6E1501C6642B /* Pods-Runner.release.xcconfig */, D319789980A1E5DD1D271629 /* Pods-Runner.profile.xcconfig */, ); - name = Pods; path = Pods; sourceTree = ""; }; diff --git a/packages/audioplayers/example/macos/Podfile.lock b/packages/audioplayers/example/macos/Podfile.lock index 26021aae8..c8357bdf0 100644 --- a/packages/audioplayers/example/macos/Podfile.lock +++ b/packages/audioplayers/example/macos/Podfile.lock @@ -21,7 +21,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: audioplayers_darwin: dcad41de4fbd0099cb3749f7ab3b0cb8f70b810c FlutterMacOS: ae6af50a8ea7d6103d888583d46bd8328a7e9811 - path_provider_macos: 160cab0d5461f0c0e02995469a98f24bdb9a3f1f + path_provider_macos: 3c0c3b4b0d4a76d2bf989a913c2de869c5641a19 PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c diff --git a/packages/audioplayers_darwin/darwin/Classes/Utils.swift b/packages/audioplayers_darwin/darwin/Classes/Utils.swift index 72bed8dff..12a9a4862 100644 --- a/packages/audioplayers_darwin/darwin/Classes/Utils.swift +++ b/packages/audioplayers_darwin/darwin/Classes/Utils.swift @@ -20,6 +20,7 @@ func toCMTime(millis: Float) -> CMTime { } func fromCMTime(time: CMTime) -> Int { + guard CMTIME_IS_NUMERIC(time) else { return 0 } let seconds: Float64 = CMTimeGetSeconds(time) let milliseconds: Int = Int(seconds * 1000) return milliseconds