You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!-- WlSurfaceView for general playback -->
<com.ywl5320.wlmedia.widget.WlSurfaceView
android:id="@+id/wlsurfaceview"android:layout_width="match_parent"android:layout_height="match_parent" />
<!-- WlTextureView for transparency, rotation, etc. -->
<com.ywl5320.wlmedia.widget.WlTextureView
android:id="@+id/wltextureview"android:layout_width="match_parent"android:layout_height="match_parent" />
4.1.5 Basic Usage (See Full Demo)
// 1. Create playerWlPlayerwlPlayer = newWlPlayer();
wlPlayer.setOnMediaInfoListener(newWlOnMediaInfoListener() {
@OverridepublicvoidonPrepared() {
wlPlayer.start(); // Start playback after preparation
}
@OverridepublicvoidonTimeInfo(doublecurrentTime, doublebufferTime) {
// Time progress callback
}
@OverridepublicvoidonComplete(WlCompleteTypetype, Stringmsg) {
switch (type) {
caseWL_COMPLETE_EOF: // Normal EOFcaseWL_COMPLETE_ERROR: // Playback error (see msg)caseWL_COMPLETE_HANDLE: // Stopped by wlPlayer.stop()caseWL_COMPLETE_NEXT: // Media switched during playbackcaseWL_COMPLETE_TIMEOUT: // TimeoutcaseWL_COMPLETE_LOOP: // Loop restartbreak;
}
}
@OverridepublicvoidonLoad(WlLoadStatusstatus, intprogress, longspeed) {
switch (status) {
caseWL_LOADING_STATUS_START: // Loading startedcaseWL_LOADING_STATUS_PROGRESS: // Loading progresscaseWL_LOADING_STATUS_FINISH: // Loading completedbreak;
}
}
@OverridepublicvoidonSeekFinish() {
// Seek completed
}
@OverridepublicvoidonFirstFrameRendered() {
// First frame rendered
}
});
// 2. Bind WlSurfaceView to playerWlSurfaceViewwlSurfaceView = findViewById(R.id.wlsurfaceview);
wlSurfaceView.setWlPlayer(wlPlayer);
wlSurfaceView.setClearLastVideoFrame(false); // Keep last framewlSurfaceView.setVideoScale(WlScaleType.WL_SCALE_FIT); // Scaling modewlSurfaceView.setVideoRotate(WlRotateType.WL_ROTATE_90); // RotationwlSurfaceView.setVideoMirror(WlMirrorType.WL_MIRROR_TOP_BOTTOM); // Mirroring// 3. Set data source and preparewlPlayer.setSource(url);
wlPlayer.prepare();