mirror of
https://github.com/LiveFastEatTrashRaccoon/RaccoonForLemmy.git
synced 2025-02-04 03:57:54 +01:00
fix: use original video aspect ratio (full width) (#1082)
This commit is contained in:
parent
99a4e1594c
commit
fa4be442a7
@ -31,7 +31,8 @@ actual fun VideoPlayer(
|
||||
val context = LocalContext.current
|
||||
val exoPlayer =
|
||||
remember {
|
||||
ExoPlayer.Builder(context)
|
||||
ExoPlayer
|
||||
.Builder(context)
|
||||
.build()
|
||||
.apply {
|
||||
val defaultDataSourceFactory = DefaultDataSource.Factory(context)
|
||||
@ -41,7 +42,8 @@ actual fun VideoPlayer(
|
||||
defaultDataSourceFactory,
|
||||
)
|
||||
val source =
|
||||
ProgressiveMediaSource.Factory(dataSourceFactory)
|
||||
ProgressiveMediaSource
|
||||
.Factory(dataSourceFactory)
|
||||
.createMediaSource(MediaItem.fromUri(url))
|
||||
setMediaSource(source)
|
||||
|
||||
@ -70,7 +72,7 @@ actual fun VideoPlayer(
|
||||
PlayerView(context).apply {
|
||||
controllerAutoShow = true
|
||||
controllerHideOnTouch = true
|
||||
resizeMode = AspectRatioFrameLayout.RESIZE_MODE_FILL
|
||||
resizeMode = AspectRatioFrameLayout.RESIZE_MODE_FIXED_WIDTH
|
||||
|
||||
player = exoPlayer
|
||||
layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT)
|
||||
|
@ -26,8 +26,6 @@ import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.Spacing
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.commonui.components.VideoPlayer
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.l10n.messages.LocalStrings
|
||||
|
||||
private const val DEFAULT_ASPECT_RATIO = 1f
|
||||
|
||||
@Composable
|
||||
fun PostCardVideo(
|
||||
modifier: Modifier = Modifier,
|
||||
@ -72,7 +70,7 @@ fun PostCardVideo(
|
||||
var loading by remember { mutableStateOf(true) }
|
||||
if (shouldBeRendered) {
|
||||
VideoPlayer(
|
||||
modifier = Modifier.aspectRatio(DEFAULT_ASPECT_RATIO),
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
url = url,
|
||||
onPlaybackStarted = {
|
||||
loading = false
|
||||
@ -83,7 +81,7 @@ fun PostCardVideo(
|
||||
modifier =
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.aspectRatio(DEFAULT_ASPECT_RATIO)
|
||||
.aspectRatio(16 / 9.0f)
|
||||
.background(backgroundColor),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user