콘텐츠 플레이어
- 재생목록 아이템 터치시 해당 아이템을 재생하는 기능 추가
This commit is contained in:
@@ -174,6 +174,16 @@ final class ContentPlayerPlayManager: NSObject, ObservableObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func playSelectedContent(content: AudioContentPlaylistContent) {
|
||||||
|
if content.id != id {
|
||||||
|
generateUrl(contentId: content.id) { [unowned self] url in
|
||||||
|
self.urlGenerateSuccess(content: content, url: url)
|
||||||
|
} onFailure: {
|
||||||
|
self.playPreviousContent()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private func urlGenerateSuccess(content: AudioContentPlaylistContent, url: String) {
|
private func urlGenerateSuccess(content: AudioContentPlaylistContent, url: String) {
|
||||||
id = content.id
|
id = content.id
|
||||||
title = content.title
|
title = content.title
|
||||||
|
@@ -66,6 +66,9 @@ struct ContentPlayerView: View {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
.cornerRadius(6.7)
|
.cornerRadius(6.7)
|
||||||
|
.onTapGesture {
|
||||||
|
playerManager.playSelectedContent(content: item)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user