File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -22,8 +22,10 @@ public final class DotLottieAnimation: ObservableObject {
22
22
23
23
internal var config : Config
24
24
25
+ #if os(iOS)
25
26
internal var dotLottieAnimationView : DotLottieAnimationView ?
26
-
27
+ #endif
28
+
27
29
internal var dotLottieView : DotLottieView ?
28
30
29
31
/// Load directly from a String (.json).
@@ -58,7 +60,6 @@ public final class DotLottieAnimation: ObservableObject {
58
60
webURL: String ,
59
61
config: AnimationConfig
60
62
) {
61
- print ( " >> LOADING " )
62
63
self . init ( config: config) {
63
64
if webURL. contains ( " .lottie " ) {
64
65
try await $0. loadDotLottieFromURL ( url: webURL)
Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ class Player: ObservableObject {
51
51
self . setPlayerState ( state: . error)
52
52
throw AnimationLoadErrors . loadAnimationDataError
53
53
}
54
+
55
+ setPlayerState ( state: self . config ( ) . autoplay ? . playing : . draw)
54
56
}
55
57
56
58
public func loadAnimationPath( animationPath: String , width: Int , height: Int ) throws {
@@ -167,8 +169,8 @@ class Player: ObservableObject {
167
169
168
170
public func play( ) -> Bool {
169
171
let play = dotLottiePlayer. play ( )
170
-
171
- if ( play ) {
172
+
173
+ if ( dotLottiePlayer . isPlaying ( ) ) {
172
174
self . setPlayerState ( state: . playing)
173
175
}
174
176
@@ -178,7 +180,7 @@ class Player: ObservableObject {
178
180
public func pause( ) -> Bool {
179
181
let pause = dotLottiePlayer. pause ( )
180
182
181
- if ( pause ) {
183
+ if ( dotLottiePlayer . isPaused ( ) ) {
182
184
self . setPlayerState ( state: . paused)
183
185
}
184
186
@@ -188,7 +190,7 @@ class Player: ObservableObject {
188
190
public func stop( ) -> Bool {
189
191
let stop = dotLottiePlayer. stop ( )
190
192
191
- if ( stop ) {
193
+ if ( dotLottiePlayer . isStopped ( ) ) {
192
194
self . setPlayerState ( state: . stopped)
193
195
}
194
196
You can’t perform that action at this time.
0 commit comments