Skip to content

Commit

Permalink
Adding comments as to why IO thread was used
Browse files Browse the repository at this point in the history
  • Loading branch information
MayuriKhinvasara committed Aug 6, 2024
1 parent 2cbf230 commit f4aedca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,8 @@ private fun MessageBubble(
@Composable
private fun VideoMessagePreview(videoUri: String, onClick: () -> Unit) {
val context = LocalContext.current.applicationContext

// Running on an IO thread for loading metadata from remote urls to reduce lag time
val bitmapState = produceState<Bitmap?>(initialValue = null) {
withContext(Dispatchers.IO) {
val mediaMetadataRetriever = MediaMetadataRetriever()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ fun MetadataOverlay(modifier: Modifier, mediaItem: TimelineMediaItem) {
val mediaMetadataRetriever = MediaMetadataRetriever()
val context = LocalContext.current.applicationContext

// Running on an IO thread for loading metadata from remote urls to reduce lag time
val duration: State<Long?> = produceState<Long?>(initialValue = null) {
withContext(Dispatchers.IO) {
// Remote url
Expand Down

0 comments on commit f4aedca

Please sign in to comment.