Exoplayer 2防止视频播放时屏幕变暗

问题描述 投票:7回答:3

我有简单的玩家活动:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.epix.presentation.player.PlayerActivity">

    <com.google.android.exoplayer2.ui.SimpleExoPlayerView
        android:id="@+id/video_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</android.support.constraint.ConstraintLayout>

[视频播放时,屏幕将变暗,我必须点击屏幕以使其再次变亮。我尝试设置android:keepScreenOn="true",这当然无济于事,因为屏幕无法关闭,只是变暗。

有没有办法防止屏幕变暗发生?

android exoplayer
3个回答
19
投票

希望这会帮助某人。


4
投票

最简单的方法是在ConstraintLayout元素中使用值为true的keepScreenOn属性:


0
投票

如果遇到问题,对话框片段上的视频视图将变暗,否则。您可以在属性中使用它:

© www.soinside.com 2019 - 2024. All rights reserved.