when i use this code to show Imageview in jetback compose it works normally
Column(
Modifier
.wrapContentHeight()
.fillMaxWidth(),
) {
Image(
modifier = Modifier.size(180.dp).align(CenterHorizontally).padding(0.dp, 64.dp, 0.dp, 0.dp),
painter = painterResource(id = com.taxa.R.drawable.ic_phone_reg),
contentDescription = ""
)
Text(
text = stringResource(headerResource),
modifier = Modifier
.fillMaxWidth(),
textAlign = TextAlign.Center,
style = MaterialTheme.typography.headlineLarge,
)
Text(
text = stringResource(bodyResource),
modifier = Modifier
.fillMaxWidth()
.padding(top = 10.dp),
textAlign = TextAlign.Center,
style = MaterialTheme.typography.titleMedium,
)
}
but when i need to show a video from raw folder instead of image and replace image with videoview
{
Column(
Modifier
.wrapContentHeight()
.fillMaxWidth(),
) {
val path = "android.resource://" + BuildConfig.APPLICATION_ID + "/" + videoResource
CommonVideoView(
path,
modifier = Modifier
.height(180.dp)
.fillMaxWidth()
.align(CenterHorizontally)
)
Text(
text = stringResource(headerResource),
modifier = Modifier
.fillMaxWidth(),
textAlign = TextAlign.Center,
style = MaterialTheme.typography.headlineLarge,
)
Text(
text = stringResource(bodyResource),
modifier = Modifier
.fillMaxWidth()
.padding(top = 10.dp),
textAlign = TextAlign.Center,
style = MaterialTheme.typography.titleMedium,
)
}
}
@Composable
fun CommonWebView(urlToRender: String, modifier: Modifier) {
AndroidView(factory = {
VideoView(it).apply {
setVideoPath(urlToRender)
setOnCompletionListener {
start()
}
start()
}
}, modifier = modifier.size(100.dp))
}
-- the video works normally but the background become black
what should i do to show the background white when i use VideoView?

