-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Proposal) [#264] media3 integration #266
Changes from 1 commit
4d024e6
69cb906
3c0e6ef
7495ff4
ef74596
e3ce3fe
b4504e6
145707a
8fde836
c684829
dce8d02
9a5e251
64f7472
9190130
a31c1c0
a399cf8
baa6902
172945e
01ef8b9
8897b93
4fda44b
a6239cf
b6c95ec
11f16f3
1ac9923
3be75f9
6cd0f3a
c55d900
93c5e6a
ab565ef
7d9204d
8f3638c
ef0a703
99b5a04
35a16d2
9955684
8f4377c
eb2781b
d905dc4
e788ab6
649e73c
29674ec
aec471e
2263e4c
bb6dc76
e4ad4f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,8 @@ interface SessionRepository { | |
suspend fun getBookmarkedSessionIds(): Flow<Set<String>> | ||
|
||
suspend fun bookmarkSession(sessionId: String, bookmark: Boolean) | ||
|
||
fun getCurrentPlayingSessionId(): Flow<String?> | ||
|
||
suspend fun updateCurrentPlayingSessionId(sessionId: String) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NOTE: 따로 repository를 빼려다가 그냥 SessionRepository에 추가하여 구현. |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.droidknights.app2023.core.domain.usecase | ||
|
||
import com.droidknights.app2023.core.data.repository.SessionRepository | ||
import kotlinx.coroutines.flow.firstOrNull | ||
import javax.inject.Inject | ||
|
||
class GetCurrentPlayingSessionUseCase @Inject constructor( | ||
private val sessionRepository: SessionRepository, | ||
) { | ||
suspend operator fun invoke(): String? { | ||
return sessionRepository.getCurrentPlayingSessionId().firstOrNull() | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NotNull 형태로 던져도 괜찮지 않을까 싶네요. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이 comment와 함께 고려했을 때, 아무것도 재생하지 않은 상태를 NonNull로 표현할 수 있을까요? 공백? 사실 명확하게 하고자 typing을 하려고 했었는데 .. ㅎㅎ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
앞선 non-null 타입을 고려한다명 명확한 타입을 정의하는것도 괜찮아 보입니다. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.droidknights.app2023.core.domain.usecase | ||
|
||
import com.droidknights.app2023.core.data.repository.SessionRepository | ||
import javax.inject.Inject | ||
|
||
class UpdateCurrentPlayingSessionUseCase @Inject constructor( | ||
private val sessionRepository: SessionRepository, | ||
) { | ||
|
||
suspend operator fun invoke(sessionId: String) { | ||
return sessionRepository.updateCurrentPlayingSessionId(sessionId) | ||
workspace marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sessionId가 null인 케이스가 있을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null인 경우 = 재생을 한번도 안한 상태입니다.
마지막으로 재생된 session id를 data store에 저장합니다.
아래 callback이 불렸을 때 마지막으로 재생하던 미디어를 재생 시키는 구현에 사용됩니다. (position은 저장 안해둠)
약식으로 대응해뒀는데 값이 null일 땐 keynote를 재생하도록 했습니다.
https://developer.android.com/guide/topics/media/session/mediasession#resumption