Skip to content

Commit

Permalink
fix(darwin): infinity / nan on getDuration (#1298)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Gustl22 committed Oct 5, 2022
1 parent 15f2c78 commit a4474dc
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 4 deletions.
55 changes: 54 additions & 1 deletion 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:
Expand All @@ -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

Expand Down
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 51;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -68,7 +68,6 @@
C3DA4DB9E96E6E1501C6642B /* Pods-Runner.release.xcconfig */,
D319789980A1E5DD1D271629 /* Pods-Runner.profile.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
Expand Down
2 changes: 1 addition & 1 deletion packages/audioplayers/example/macos/Podfile.lock
Expand Up @@ -21,7 +21,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
audioplayers_darwin: dcad41de4fbd0099cb3749f7ab3b0cb8f70b810c
FlutterMacOS: ae6af50a8ea7d6103d888583d46bd8328a7e9811
path_provider_macos: 160cab0d5461f0c0e02995469a98f24bdb9a3f1f
path_provider_macos: 3c0c3b4b0d4a76d2bf989a913c2de869c5641a19

PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c

Expand Down
1 change: 1 addition & 0 deletions packages/audioplayers_darwin/darwin/Classes/Utils.swift
Expand Up @@ -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
Expand Down

0 comments on commit a4474dc

Please sign in to comment.