File tree Expand file tree Collapse file tree 3 files changed +13
-9
lines changed
Example/VLCUIExample/Shared Expand file tree Collapse file tree 3 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -10,14 +10,8 @@ struct ContentView: View {
10
10
ZStack ( alignment: . bottom) {
11
11
VLCVideoPlayer ( configuration: viewModel. configuration)
12
12
. proxy ( viewModel. proxy)
13
- . onTicksUpdated { ticks, playbackInformation in
14
- viewModel. ticks = ticks
15
- viewModel. totalTicks = playbackInformation. length
16
- viewModel. position = playbackInformation. position
17
- }
18
- . onStateUpdated { state, _ in
19
- viewModel. playerState = state
20
- }
13
+ . onStateUpdated ( viewModel. onStateUpdated)
14
+ . onTicksUpdated ( viewModel. onTicksUpdated)
21
15
22
16
OverlayView ( viewModel: viewModel)
23
17
. padding ( )
Original file line number Diff line number Diff line change @@ -33,4 +33,14 @@ class ContentViewModel: ObservableObject {
33
33
func setCustomPosition( _ newPosition: Float ) {
34
34
position = newPosition
35
35
}
36
+
37
+ func onStateUpdated( _ newState: VLCVideoPlayer . State , _ playbackInformation: VLCVideoPlayer . PlaybackInformation ) {
38
+ playerState = newState
39
+ }
40
+
41
+ func onTicksUpdated( _ newTicks: Int , _ playbackInformation: VLCVideoPlayer . PlaybackInformation ) {
42
+ position = playbackInformation. position
43
+ ticks = newTicks
44
+ totalTicks = playbackInformation. length
45
+ }
36
46
}
Original file line number Diff line number Diff line change @@ -9,6 +9,6 @@ extension Int {
9
9
formatter. unitsStyle = . positional
10
10
formatter. zeroFormattingBehavior = . pad
11
11
12
- return formatter. string ( from: TimeInterval ( Int ( self ) ) ) ?? " --:-- "
12
+ return formatter. string ( from: TimeInterval ( self ) ) ?? " --:-- "
13
13
}
14
14
}
You can’t perform that action at this time.
0 commit comments