From 36e4caafae5f3c7364b450b5d6bf8ce899f733ac Mon Sep 17 00:00:00 2001 From: 21561 <215613905@qq.com> Date: Sun, 20 Apr 2025 12:57:44 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=8C=87=E5=AE=9A=E7=9B=B4=E6=92=ADplaye?= =?UTF-8?q?rType=E7=9A=84bug;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/github/tvbox/osc/api/ApiConfig.java | 4 ++++ .../github/tvbox/osc/bean/LivePlayerManager.java | 15 ++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/github/tvbox/osc/api/ApiConfig.java b/app/src/main/java/com/github/tvbox/osc/api/ApiConfig.java index be58fb88..b4258d9a 100644 --- a/app/src/main/java/com/github/tvbox/osc/api/ApiConfig.java +++ b/app/src/main/java/com/github/tvbox/osc/api/ApiConfig.java @@ -876,11 +876,15 @@ public class ApiConfig { if(livesOBJ.has("epg")){ String epg =livesOBJ.get("epg").getAsString(); Hawk.put(HawkConfig.EPG_URL,epg); + }else { + Hawk.put(HawkConfig.EPG_URL,""); } //直播播放器类型 if(livesOBJ.has("playerType")){ String livePlayType =livesOBJ.get("playerType").getAsString(); Hawk.put(HawkConfig.LIVE_PLAY_TYPE,livePlayType); + }else { + Hawk.put(HawkConfig.LIVE_PLAY_TYPE,Hawk.get(HawkConfig.PLAY_TYPE, 0)); } //设置UA if(livesOBJ.has("header")) { diff --git a/app/src/main/java/com/github/tvbox/osc/bean/LivePlayerManager.java b/app/src/main/java/com/github/tvbox/osc/bean/LivePlayerManager.java index 6477ec01..f7563267 100644 --- a/app/src/main/java/com/github/tvbox/osc/bean/LivePlayerManager.java +++ b/app/src/main/java/com/github/tvbox/osc/bean/LivePlayerManager.java @@ -1,9 +1,7 @@ package com.github.tvbox.osc.bean; import androidx.annotation.NonNull; -import androidx.exifinterface.media.ExifInterface; -import com.github.tvbox.osc.api.ApiConfig; import com.github.tvbox.osc.util.HawkConfig; import com.github.tvbox.osc.util.PlayerHelper; import com.orhanobut.hawk.Hawk; @@ -11,17 +9,16 @@ import com.orhanobut.hawk.Hawk; import org.json.JSONException; import org.json.JSONObject; -import java.util.HashMap; -import java.util.Objects; - import xyz.doikki.videoplayer.player.VideoView; public class LivePlayerManager { JSONObject defaultPlayerConfig = new JSONObject(); JSONObject currentPlayerConfig; + private String currentApi=""; public void init(VideoView videoView) { try { + currentApi=Hawk.get(HawkConfig.LIVE_API_URL,""); defaultPlayerConfig.put("pl", Hawk.get(HawkConfig.LIVE_PLAY_TYPE, Hawk.get(HawkConfig.PLAY_TYPE, 0))); defaultPlayerConfig.put("ijk", Hawk.get(HawkConfig.IJK_CODEC, "硬解码")); defaultPlayerConfig.put("pr", Hawk.get(HawkConfig.PLAY_RENDER, 0)); @@ -42,6 +39,7 @@ public class LivePlayerManager { } public void getLiveChannelPlayer(VideoView videoView, String channelName) { + channelName=currentCfgKey(channelName); JSONObject playerConfig = Hawk.get(channelName, null); if (playerConfig == null) { if (!currentPlayerConfig.toString().equals(defaultPlayerConfig.toString())) @@ -101,6 +99,7 @@ public class LivePlayerManager { } public void changeLivePlayerType(VideoView videoView, int playerType, String channelName) { + channelName=currentCfgKey(channelName); JSONObject playerConfig = currentPlayerConfig; try { switch (playerType) { @@ -135,6 +134,7 @@ public class LivePlayerManager { } public void changeLivePlayerScale(@NonNull VideoView videoView, int playerScale, String channelName){ + channelName=currentCfgKey(channelName); videoView.setScreenScaleType(playerScale); JSONObject playerConfig = currentPlayerConfig; @@ -150,4 +150,9 @@ public class LivePlayerManager { currentPlayerConfig = playerConfig; } + + private String currentCfgKey(String channelName) + { + return currentApi+"_"+channelName; + } } \ No newline at end of file