添加search

This commit is contained in:
sifacaii 2022-08-29 12:44:19 +08:00
parent 8cc08ebe2e
commit 13b062c0c3
2 changed files with 9 additions and 6 deletions

View File

@ -16,6 +16,8 @@ import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.MediaPlayer; import org.videolan.libvlc.MediaPlayer;
import org.videolan.libvlc.util.VLCVideoLayout; import org.videolan.libvlc.util.VLCVideoLayout;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
@ -81,8 +83,10 @@ public class VlcPlayerActivity extends BaseActivity implements MediaPlayer.Event
* 初始化播放器 * 初始化播放器
*/ */
private void initVlc() { private void initVlc() {
List<String> vlcoptions = new ArrayList<>();
vlcoptions.add("-vvv");
vlcVideoLayout = findViewById(R.id.VideoView); vlcVideoLayout = findViewById(R.id.VideoView);
libVLC = new LibVLC(this); libVLC = new LibVLC(this,vlcoptions);
mediaPlayer = new MediaPlayer(libVLC); mediaPlayer = new MediaPlayer(libVLC);
mediaPlayer.attachViews(vlcVideoLayout, null, true, false); mediaPlayer.attachViews(vlcVideoLayout, null, true, false);
mediaPlayer.setEventListener(this); mediaPlayer.setEventListener(this);
@ -457,7 +461,7 @@ public class VlcPlayerActivity extends BaseActivity implements MediaPlayer.Event
} }
/** /**
* 设置播放器位置 * 设置播放器进度
*/ */
public boolean setTimeOnSeekBar(Long p) { public boolean setTimeOnSeekBar(Long p) {
if (p < mediaPlayer.getLength() && p > 0) { if (p < mediaPlayer.getLength() && p > 0) {
@ -567,7 +571,6 @@ public class VlcPlayerActivity extends BaseActivity implements MediaPlayer.Event
} else if (type == Utils.ReportType.stop) { } else if (type == Utils.ReportType.stop) {
Utils.ReportPlaybackStop(Id, currPlaybackTimeTrack); Utils.ReportPlaybackStop(Id, currPlaybackTimeTrack);
} else if (type == Utils.ReportType.Progress) { } else if (type == Utils.ReportType.Progress) {
Log.d(TAG, "run: 报告时空:" + currPlaybackTimeTrack);
Utils.ReportPlaybackProgress(Id, currPlaybackTimeTrack); Utils.ReportPlaybackProgress(Id, currPlaybackTimeTrack);
} }
} }

View File

@ -97,9 +97,9 @@
android:id="@+id/tvPlay" android:id="@+id/tvPlay"
android:layout_width="160dp" android:layout_width="160dp"
android:layout_height="60dp" android:layout_height="60dp"
android:layout_marginTop="60dp" android:layout_marginTop="30dp"
android:layout_marginLeft="60dp" android:layout_marginLeft="50dp"
android:padding="6dp" android:padding="10dp"
android:focusable="true" android:focusable="true"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:src="@drawable/ic_outline_play_circle_outline_128" android:src="@drawable/ic_outline_play_circle_outline_128"