Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bfc88db

Browse files
Update README.md
1 parent 6fe7d6e commit bfc88db

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

‎README.md‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,15 @@ To ensure .play is applied before .pause, you can use `Task` to schedule the sec
170170
```swift
171171
playbackCommand = .play
172172

173-
Task { @MainActor
173+
Task { @MainActorin
174174
playbackCommand = .pause
175175
Task { playbackCommand = .play } // This runs AFTER `.pause`
176176
}
177177
```
178178

179179
### Handling Sequential Similar Commands
180180

181-
When using the video player controls in your SwiftUI application, it's important to understand how command processing works. Specifically, issuing two identical commands consecutively will result in the second command being ignored. This is due to the underlying implementation in SwiftUI that prevents redundant command execution to optimize performance and user experience.
181+
When using the video player controls in your SwiftUI application, it's important to understand how command processing works. Specifically, issuing two identical commands consecutively will result in the second command being ignored. This is due to the underlying implementation that prevents redundant command execution to optimize performance and user experience in terms of UI updates.
182182

183183
### Common Scenario
184184

@@ -188,6 +188,16 @@ For example, if you attempt to pause the video player twice in a row, the second
188188

189189
In cases where you need to re-issue a command that might appear redundant but is necessary under specific conditions, you must insert an `idle` command between the two similar commands. The `idle` command resets the command state of the player, allowing subsequent commands to be processed as new actions.
190190

191+
**.play → .idle → .play**
192+
193+
```swift
194+
playbackCommand = .play
195+
196+
Task { @MainActor in
197+
playbackCommand = .idle
198+
Task { playbackCommand = .play } // This runs AFTER `.idle`
199+
200+
191201
### Playback Commands
192202

193203
| Command | Description |

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /