|
|
|
|
@ -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; |
|
|
|
|
} |
|
|
|
|
} |