fix 播放器url為空時不播放

This commit is contained in:
zlzw 2023-09-22 14:27:23 +08:00
parent 326ced4646
commit c015459cf1

View File

@ -21,6 +21,7 @@ import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
import com.google.android.exoplayer2.ui.StyledPlayerView; import com.google.android.exoplayer2.ui.StyledPlayerView;
import com.google.android.exoplayer2.video.VideoSize; import com.google.android.exoplayer2.video.VideoSize;
import com.lzf.easyfloat.EasyFloat; import com.lzf.easyfloat.EasyFloat;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
@ -393,7 +394,7 @@ public class LiveExoPlayerManager {
* @param url 地址 * @param url 地址
*/ */
public void startUrl(String url) { public void startUrl(String url) {
if (url != null && url.equals(this.url)) return; if (!StringUtil.isEmpty(url) && url.equals(this.url)) return;
if (task != null) { if (task != null) {
task.cancel(); task.cancel();
task = null; task = null;
@ -421,7 +422,7 @@ public class LiveExoPlayerManager {
* @param url 地址 * @param url 地址
*/ */
public void switchUrl(String url) { public void switchUrl(String url) {
if (url != null && url.equals(this.url)) return; if (!StringUtil.isEmpty(url) && url.equals(this.url)) return;
if (task != null) { if (task != null) {
task.cancel(); task.cancel();
task = null; task = null;