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 9ddd431

Browse files
update
1 parent 620df96 commit 9ddd431

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

‎Sources/swiftui-loop-videoplayer/protocol/player/AbstractPlayer.swift‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,14 @@ extension AbstractPlayer{
230230
return
231231
}
232232

233-
itemStatusObserver = item.observe(\.status, options: [.new, .initial,.old]) { [weak self] item, change in
234-
print(item.status.rawValue, "status")
233+
itemStatusObserver = item.observe(\.status, options: [.new, .initial]) { [weak self] observedItem, change in
234+
print(observedItem.status.rawValue, "status")
235235

236-
guard [.readyToPlay, .failed].contains(item.status) else {
236+
guard [.readyToPlay, .failed].contains(observedItem.status) else {
237237
return
238238
}
239239

240-
callback(item.status)
240+
callback(observedItem.status)
241241

242242
Task { @MainActor in
243243
self?.clearStatusObserver()
@@ -276,7 +276,7 @@ extension AbstractPlayer{
276276
delegate?.didSeek(value: false, currentTime: time)
277277
return
278278
}
279-
279+
280280
let callback: ItemStatusCallback = { [weak self] status in
281281
if status == .readyToPlay {
282282
self?.seek(to: time, play: play)
@@ -286,9 +286,9 @@ extension AbstractPlayer{
286286
}
287287

288288
update(settings: settings, doUpdate: true) { [weak self] item in
289-
/// DispatchQueue.main.asyncAfter(deadline: .now() + 0.5){
290-
self?.setupStateStatusObserver(for: item, callback: callback)
291-
/// }
289+
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5){
290+
self?.setupStateStatusObserver(for: item, callback: callback)
291+
}
292292
}
293293
}
294294

‎Sources/swiftui-loop-videoplayer/protocol/player/ExtPlayerProtocol.swift‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,14 @@ internal extension ExtPlayerProtocol {
191191
}
192192

193193
callback?(newItem)
194+
194195
insert(newItem)
195196

196-
if settings.loop{
197+
if settings.loop{
197198
loop()
198199
}
199200

200-
if !settings.notAutoPlay{
201+
if !settings.notAutoPlay{
201202
play()
202203
}
203204
}

‎Sources/swiftui-loop-videoplayer/utils/VideoSettings.swift‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ public struct VideoSettings: Equatable{
107107
public extension VideoSettings {
108108

109109
/// Returns a new instance of VideoSettings with loop set to false and notAutoPlay set to true, keeping other settings unchanged.
110-
var GetSettingsWithNotAutoPlay : VideoSettings {
111-
VideoSettings(name: self.name, ext: self.ext, subtitles: self.subtitles, loop: self.loop, mute: self.mute, notAutoPlay: true, timePublishing: self.timePublishing, gravity: self.gravity, enableVector: self.vector)
110+
var settingsWithAutoPlay : VideoSettings {
111+
VideoSettings(name: self.name, ext: self.ext, subtitles: self.subtitles, loop: self.loop, mute: self.mute, notAutoPlay: false, timePublishing: self.timePublishing, gravity: self.gravity, enableVector: self.vector)
112112
}
113113

114114
func getAssets()-> AVURLAsset?{

0 commit comments

Comments
(0)

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