mirror of https://github.com/FongMi/TV.git
parent
cdc344049f
commit
77e741afe4
@ -0,0 +1,173 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||
xmlns:tools="http://schemas.android.com/tools" |
||||
android:id="@+id/exo_bottom_bar" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_gravity="bottom" |
||||
android:background="@drawable/shape_controller" |
||||
android:orientation="vertical" |
||||
android:paddingStart="16dp" |
||||
android:paddingTop="16dp" |
||||
android:paddingEnd="16dp" |
||||
android:paddingBottom="8dp"> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:animateLayoutChanges="true" |
||||
android:gravity="center_vertical" |
||||
android:orientation="horizontal"> |
||||
|
||||
<TextView |
||||
android:id="@+id/number" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginEnd="12dp" |
||||
android:textColor="@color/grey_800" |
||||
android:textSize="18sp" |
||||
tools:text="005" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/name" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginEnd="12dp" |
||||
android:maxEms="30" |
||||
android:singleLine="true" |
||||
android:textColor="@color/grey_800" |
||||
android:textSize="18sp" |
||||
tools:text="民視" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/play" |
||||
android:layout_width="0dp" |
||||
android:layout_height="wrap_content" |
||||
android:layout_gravity="center" |
||||
android:layout_marginEnd="12dp" |
||||
android:layout_weight="1" |
||||
android:singleLine="true" |
||||
android:textColor="@color/grey_800" |
||||
android:textSize="18sp" |
||||
tools:text="正在播放:食神" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/home" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginEnd="12dp" |
||||
android:background="@drawable/selector_text" |
||||
android:focusable="true" |
||||
android:focusableInTouchMode="true" |
||||
android:textColor="@color/white" |
||||
android:textSize="14sp" |
||||
tools:text="首頁" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/line" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginEnd="12dp" |
||||
android:background="@drawable/selector_text" |
||||
android:focusable="true" |
||||
android:focusableInTouchMode="true" |
||||
android:textColor="@color/white" |
||||
android:textSize="14sp" |
||||
android:visibility="gone" |
||||
tools:text="來源 1" |
||||
tools:visibility="visible" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/player" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginEnd="12dp" |
||||
android:background="@drawable/selector_text" |
||||
android:focusable="true" |
||||
android:focusableInTouchMode="true" |
||||
android:textColor="@color/white" |
||||
android:textSize="14sp" |
||||
tools:text="EXO" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/speed" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginEnd="12dp" |
||||
android:background="@drawable/selector_text" |
||||
android:focusable="true" |
||||
android:focusableInTouchMode="true" |
||||
android:textColor="@color/white" |
||||
android:textSize="14sp" |
||||
tools:text="1.00" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/scale" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:background="@drawable/selector_text" |
||||
android:focusable="true" |
||||
android:focusableInTouchMode="true" |
||||
android:textColor="@color/white" |
||||
android:textSize="14sp" |
||||
tools:text="預設" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tracks" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginStart="12dp" |
||||
android:background="@drawable/selector_text" |
||||
android:focusable="true" |
||||
android:focusableInTouchMode="true" |
||||
android:text="@string/play_tracks" |
||||
android:textColor="@color/white" |
||||
android:textSize="14sp" |
||||
android:visibility="gone" |
||||
tools:visibility="visible" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="8dp" |
||||
android:gravity="center" |
||||
android:orientation="horizontal"> |
||||
|
||||
<TextView |
||||
android:id="@+id/position" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:textColor="@color/grey_700" |
||||
android:textSize="16sp" |
||||
tools:text="00:00:00" /> |
||||
|
||||
<com.google.android.exoplayer2.ui.DefaultTimeBar |
||||
android:id="@+id/progress" |
||||
android:layout_width="0dp" |
||||
android:layout_height="26dp" |
||||
android:layout_marginStart="8dp" |
||||
android:layout_marginEnd="8dp" |
||||
android:layout_weight="1" |
||||
android:focusable="true" |
||||
android:focusableInTouchMode="true" |
||||
android:nextFocusLeft="@+id/progress" |
||||
android:nextFocusRight="@+id/progress" |
||||
android:nextFocusDown="@+id/progress" |
||||
app:buffered_color="@color/grey_700" |
||||
app:played_color="@color/blue_700" |
||||
app:scrubber_color="@color/blue_500" |
||||
app:unplayed_color="@color/grey_500" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/duration" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:textColor="@color/grey_700" |
||||
android:textSize="16sp" |
||||
tools:text="00:00:00" /> |
||||
|
||||
</LinearLayout> |
||||
</LinearLayout> |
||||
@ -1,165 +0,0 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||
xmlns:tools="http://schemas.android.com/tools"> |
||||
|
||||
<LinearLayout |
||||
android:id="@+id/exo_bottom_bar" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_gravity="bottom" |
||||
android:background="@drawable/shape_controller" |
||||
android:orientation="vertical" |
||||
android:paddingStart="16dp" |
||||
android:paddingTop="16dp" |
||||
android:paddingEnd="16dp" |
||||
android:paddingBottom="8dp"> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:animateLayoutChanges="true" |
||||
android:gravity="center_vertical" |
||||
android:orientation="horizontal"> |
||||
|
||||
<TextView |
||||
android:id="@+id/number" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginEnd="12dp" |
||||
android:textColor="@color/grey_800" |
||||
android:textSize="18sp" |
||||
tools:text="005" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/name" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginEnd="12dp" |
||||
android:maxEms="30" |
||||
android:singleLine="true" |
||||
android:textColor="@color/grey_800" |
||||
android:textSize="18sp" |
||||
tools:text="民視" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/play" |
||||
android:layout_width="0dp" |
||||
android:layout_height="wrap_content" |
||||
android:layout_gravity="center" |
||||
android:layout_marginEnd="12dp" |
||||
android:layout_weight="1" |
||||
android:singleLine="true" |
||||
android:textColor="@color/grey_800" |
||||
android:textSize="18sp" |
||||
tools:text="正在播放:食神" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/home" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginEnd="12dp" |
||||
android:background="@drawable/selector_text" |
||||
android:focusable="true" |
||||
android:focusableInTouchMode="true" |
||||
android:textColor="@color/white" |
||||
android:textSize="14sp" |
||||
tools:text="首頁" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/line" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginEnd="12dp" |
||||
android:background="@drawable/selector_text" |
||||
android:focusable="true" |
||||
android:focusableInTouchMode="true" |
||||
android:textColor="@color/white" |
||||
android:textSize="14sp" |
||||
android:visibility="gone" |
||||
tools:text="來源 1" |
||||
tools:visibility="visible" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/speed" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginEnd="12dp" |
||||
android:background="@drawable/selector_text" |
||||
android:focusable="true" |
||||
android:focusableInTouchMode="true" |
||||
android:textColor="@color/white" |
||||
android:textSize="14sp" |
||||
tools:text="1.00" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/scale" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:background="@drawable/selector_text" |
||||
android:focusable="true" |
||||
android:focusableInTouchMode="true" |
||||
android:textColor="@color/white" |
||||
android:textSize="14sp" |
||||
tools:text="預設" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tracks" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginStart="12dp" |
||||
android:background="@drawable/selector_text" |
||||
android:focusable="true" |
||||
android:focusableInTouchMode="true" |
||||
android:text="@string/play_tracks" |
||||
android:textColor="@color/white" |
||||
android:textSize="14sp" |
||||
android:visibility="gone" |
||||
tools:visibility="visible" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<LinearLayout |
||||
android:id="@id/exo_time" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="8dp" |
||||
android:gravity="center" |
||||
android:orientation="horizontal"> |
||||
|
||||
<TextView |
||||
android:id="@id/exo_position" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:textColor="@color/grey_700" |
||||
android:textSize="16sp" |
||||
tools:text="00:00:00" /> |
||||
|
||||
<com.google.android.exoplayer2.ui.DefaultTimeBar |
||||
android:id="@id/exo_progress" |
||||
android:layout_width="0dp" |
||||
android:layout_height="26dp" |
||||
android:layout_marginStart="8dp" |
||||
android:layout_marginEnd="8dp" |
||||
android:layout_weight="1" |
||||
android:focusable="true" |
||||
android:focusableInTouchMode="true" |
||||
android:nextFocusLeft="@id/exo_progress" |
||||
android:nextFocusRight="@id/exo_progress" |
||||
android:nextFocusDown="@id/exo_progress" |
||||
app:buffered_color="@color/grey_700" |
||||
app:played_color="@color/blue_700" |
||||
app:scrubber_color="@color/blue_500" |
||||
app:unplayed_color="@color/grey_500" /> |
||||
|
||||
<TextView |
||||
android:id="@id/exo_duration" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:textColor="@color/grey_700" |
||||
android:textSize="16sp" |
||||
tools:text="00:00:00" /> |
||||
|
||||
</LinearLayout> |
||||
</LinearLayout> |
||||
</merge> |
||||
@ -0,0 +1,37 @@ |
||||
package com.fongmi.android.tv.player; |
||||
|
||||
import tv.danmaku.ijk.media.player.IjkMediaPlayer; |
||||
|
||||
public class IjkUtil { |
||||
|
||||
public static IjkMediaPlayer createPlayer() { |
||||
int player = IjkMediaPlayer.OPT_CATEGORY_PLAYER; |
||||
int codec = IjkMediaPlayer.OPT_CATEGORY_CODEC; |
||||
int format = IjkMediaPlayer.OPT_CATEGORY_FORMAT; |
||||
IjkMediaPlayer ijkPlayer = new IjkMediaPlayer(); |
||||
ijkPlayer.setOption(codec, "skip_loop_filter", 48); |
||||
ijkPlayer.setOption(format, "probesize", 1024 * 800); |
||||
ijkPlayer.setOption(player, "max-buffer-size", 1024 * 800); |
||||
ijkPlayer.setOption(format, "analyzeduration", 30 * 1000 * 1000); |
||||
ijkPlayer.setOption(format, "analyzemaxduration", 30 * 1000 * 1000); |
||||
ijkPlayer.setOption(player, "soundtouch", 1); |
||||
ijkPlayer.setOption(format, "flush_packets", 1); |
||||
ijkPlayer.setOption(player, "packet-buffering", 0); |
||||
ijkPlayer.setOption(player, "reconnect", 1); |
||||
ijkPlayer.setOption(player, "framedrop", 1); |
||||
ijkPlayer.setOption(player, "max-fps", 60); |
||||
ijkPlayer.setOption(player, "enable-accurate-seek", 0); |
||||
ijkPlayer.setOption(format, "fflags", "fastseek"); |
||||
ijkPlayer.setOption(format, "dns_cache_clear", 1); |
||||
ijkPlayer.setOption(format, "timeout", 30 * 1000 * 1000); |
||||
ijkPlayer.setOption(format, "rtsp_transport", "tcp"); |
||||
ijkPlayer.setOption(format, "rtsp_flags", "prefer_tcp"); |
||||
ijkPlayer.setOption(format, "buffer_size", 1024 * 800); |
||||
ijkPlayer.setOption(format, "infbuf", 1); |
||||
ijkPlayer.setOption(player, "videotoolbox", 0); |
||||
ijkPlayer.setOption(player, "mediacodec", 0); |
||||
ijkPlayer.setOption(player, "mediacodec-auto-rotate", 0); |
||||
ijkPlayer.setOption(player, "mediacodec-handle-resolution-change", 0); |
||||
return ijkPlayer; |
||||
} |
||||
} |
||||
Loading…
Reference in new issue