dm-146
This commit is contained in:
parent
78c3c7f218
commit
ae89ad03fd
2 changed files with 15 additions and 1 deletions
|
|
@ -104,4 +104,7 @@ dependencies {
|
||||||
val media3Version = "1.5.1" // 建議統一宣告版本,避免版本衝突
|
val media3Version = "1.5.1" // 建議統一宣告版本,避免版本衝突
|
||||||
implementation("androidx.media3:media3-exoplayer:$media3Version")
|
implementation("androidx.media3:media3-exoplayer:$media3Version")
|
||||||
implementation("androidx.media3:media3-ui:$media3Version")
|
implementation("androidx.media3:media3-ui:$media3Version")
|
||||||
|
|
||||||
|
//video decode
|
||||||
|
implementation("io.coil-kt:coil-video:2.6.0")
|
||||||
}
|
}
|
||||||
|
|
@ -77,6 +77,8 @@ import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.material.icons.filled.Call
|
import androidx.compose.material.icons.filled.Call
|
||||||
import androidx.compose.material.icons.filled.MoreVert
|
import androidx.compose.material.icons.filled.MoreVert
|
||||||
import androidx.compose.material.icons.filled.PlayArrow
|
import androidx.compose.material.icons.filled.PlayArrow
|
||||||
|
import coil.ImageLoader
|
||||||
|
import coil.decode.VideoFrameDecoder
|
||||||
import com.example.login_v3.data.api.api_class.CallLogInfo
|
import com.example.login_v3.data.api.api_class.CallLogInfo
|
||||||
import com.example.login_v3.home.Message.UI.Detail.Message_Component.CallLogBubble
|
import com.example.login_v3.home.Message.UI.Detail.Message_Component.CallLogBubble
|
||||||
import com.example.login_v3.home.Message.UI.Detail.Message_Component.ImageLightbox
|
import com.example.login_v3.home.Message.UI.Detail.Message_Component.ImageLightbox
|
||||||
|
|
@ -739,9 +741,18 @@ fun MessageRow(
|
||||||
AsyncImage(
|
AsyncImage(
|
||||||
model = finalMediaUrl,
|
model = finalMediaUrl,
|
||||||
contentDescription = "影片預覽",
|
contentDescription = "影片預覽",
|
||||||
|
// 🌟 注入一個支援影片解碼的 ImageLoader
|
||||||
|
imageLoader = ImageLoader.Builder(LocalContext.current)
|
||||||
|
.components {
|
||||||
|
add(VideoFrameDecoder.Factory())
|
||||||
|
}
|
||||||
|
.build(),
|
||||||
contentScale = ContentScale.Crop,
|
contentScale = ContentScale.Crop,
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
alpha = 0.8f // 稍微壓暗,讓播放按鈕更明顯
|
alpha = 0.8f,
|
||||||
|
onError = { errorState ->
|
||||||
|
android.util.Log.e("ChatVideoThumbError", "原因: ${errorState.result.throwable}")
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// 播放圖示容器
|
// 播放圖示容器
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue