From 5f7337bcdcec8d14b5841dbd3d78b1a69efe93a4 Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Wed, 26 Feb 2025 14:38:59 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BD=98=ED=85=90=EC=B8=A0=20=ED=94=8C?= =?UTF-8?q?=EB=A0=88=EC=9D=B4=EC=96=B4=20-=20=EC=9E=AC=EC=83=9D=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20=EC=95=84=EC=9D=B4=ED=85=9C=20=ED=84=B0=EC=B9=98?= =?UTF-8?q?=EC=8B=9C=20=ED=95=B4=EB=8B=B9=20=EC=95=84=EC=9D=B4=ED=85=9C?= =?UTF-8?q?=EC=9D=84=20=EC=9E=AC=EC=83=9D=ED=95=98=EB=8A=94=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Content/Player/ContentPlayerPlayManager.swift | 10 ++++++++++ .../Sources/Content/Player/ContentPlayerView.swift | 3 +++ 2 files changed, 13 insertions(+) diff --git a/SodaLive/Sources/Content/Player/ContentPlayerPlayManager.swift b/SodaLive/Sources/Content/Player/ContentPlayerPlayManager.swift index 26f4cfa..5684068 100644 --- a/SodaLive/Sources/Content/Player/ContentPlayerPlayManager.swift +++ b/SodaLive/Sources/Content/Player/ContentPlayerPlayManager.swift @@ -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) { id = content.id title = content.title diff --git a/SodaLive/Sources/Content/Player/ContentPlayerView.swift b/SodaLive/Sources/Content/Player/ContentPlayerView.swift index fae9274..ea4fbab 100644 --- a/SodaLive/Sources/Content/Player/ContentPlayerView.swift +++ b/SodaLive/Sources/Content/Player/ContentPlayerView.swift @@ -66,6 +66,9 @@ struct ContentPlayerView: View { ) ) .cornerRadius(6.7) + .onTapGesture { + playerManager.playSelectedContent(content: item) + } } } }