diff --git a/app/build.gradle b/app/build.gradle index 071f4de3fd..5950e985e0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -70,6 +70,7 @@ dependencies { implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation files('libs/thunder.jar') implementation files('libs/commons-lang3-3.12.0.jar') + implementation files('libs/xwalk_shared_library-23.53.589.4.aar') implementation 'com.squareup.okhttp3:okhttp:3.12.11' annotationProcessor 'androidx.room:room-compiler:2.3.0' @@ -90,9 +91,9 @@ dependencies { implementation project(":player") implementation project(":quickjs") - implementation('org.xwalk:xwalk_shared_library:23.53.589.4') { - exclude group: 'com.android.support' - } +// implementation('org.xwalk:xwalk_shared_library:23.53.589.4') { +// exclude group: 'com.android.support' +// } implementation 'com.lzy.net:okgo:3.0.4' // implementation 'com.tencent.bugly:crashreport_upgrade:latest.release' implementation 'com.owen:tv-recyclerview:3.0.0' 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 7d563532cb..930570c2bd 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 @@ -156,10 +156,11 @@ public void loadConfig(boolean useCache, LoadConfigCallback callback, Activity a } else if (apiUrl.startsWith("clan")) { configUrl = clanToAddress(apiUrl); } else if (!apiUrl.startsWith("http")) { - configUrl = "http://" + configUrl; + configUrl = "http://" + apiUrl; } else { configUrl = apiUrl; } + String configKey = TempKey; OkGo.get(configUrl) .headers("User-Agent", userAgent) @@ -502,7 +503,7 @@ private void parseJson(String apiUrl, String jsonStr) { if(ijkCodes==null){ ijkCodes = new ArrayList<>(); boolean foundOldSelect = false; - String ijkCodec = Hawk.get(HawkConfig.IJK_CODEC, ""); + String ijkCodec = Hawk.get(HawkConfig.IJK_CODEC, "硬解码"); JsonArray ijkJsonArray = infoJson.has("ijk")?infoJson.get("ijk").getAsJsonArray():defaultJson.get("ijk").getAsJsonArray(); for (JsonElement opt : ijkJsonArray) { JsonObject obj = (JsonObject) opt; @@ -660,7 +661,7 @@ public List getIjkCodes() { } public IJKCode getCurrentIJKCode() { - String codeName = Hawk.get(HawkConfig.IJK_CODEC, ""); + String codeName = Hawk.get(HawkConfig.IJK_CODEC, "硬解码"); return getIJKCodec(codeName); } 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 1c4b23e44a..14484550ed 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 @@ -23,7 +23,7 @@ public class LivePlayerManager { public void init(VideoView videoView) { try { defaultPlayerConfig.put("pl", Hawk.get(HawkConfig.PLAY_TYPE, 0)); - defaultPlayerConfig.put("ijk", Hawk.get(HawkConfig.IJK_CODEC, "软解码")); + defaultPlayerConfig.put("ijk", Hawk.get(HawkConfig.IJK_CODEC, "硬解码")); defaultPlayerConfig.put("pr", Hawk.get(HawkConfig.PLAY_RENDER, 0)); defaultPlayerConfig.put("sc", Hawk.get(HawkConfig.PLAY_SCALE, 0)); } catch (JSONException e) { diff --git a/app/src/main/java/com/github/tvbox/osc/player/IjkMediaPlayer.java b/app/src/main/java/com/github/tvbox/osc/player/IjkMediaPlayer.java index e1af7db7e6..fa0f8e5bdf 100644 --- a/app/src/main/java/com/github/tvbox/osc/player/IjkMediaPlayer.java +++ b/app/src/main/java/com/github/tvbox/osc/player/IjkMediaPlayer.java @@ -50,9 +50,7 @@ public void setOptions() { } // 在每个数据包之后启用 I/O 上下文的刷新 - mMediaPlayer.setOption(tv.danmaku.ijk.media.player.IjkMediaPlayer.OPT_CATEGORY_FORMAT, "flush_packets", 1); - // 当 CPU 处理不过来的时候的丢帧帧数,默认为 0,参数范围是 [-1, 120] - mMediaPlayer.setOption(tv.danmaku.ijk.media.player.IjkMediaPlayer.OPT_CATEGORY_PLAYER, "framedrop", 5); +// mMediaPlayer.setOption(tv.danmaku.ijk.media.player.IjkMediaPlayer.OPT_CATEGORY_FORMAT, "flush_packets", 1); // 设置视频流格式 mMediaPlayer.setOption(tv.danmaku.ijk.media.player.IjkMediaPlayer.OPT_CATEGORY_PLAYER, "overlay-format", tv.danmaku.ijk.media.player.IjkMediaPlayer.SDL_FCC_RV32); @@ -132,12 +130,13 @@ public TrackInfo getTrackInfo() { int index = 0; for (IjkTrackInfo info : trackInfo) { if (info.getTrackType() == ITrackInfo.MEDIA_TRACK_TYPE_AUDIO) {//音轨信息 - TrackInfoBean t = new TrackInfoBean(); - t.name = info.getInfoInline(); - t.language = info.getLanguage(); - t.index = index; - t.selected = index == audioSelected; - data.addAudio(t); + TrackInfoBean a = new TrackInfoBean(); + a.name = info.getInfoInline(); + a.language = info.getLanguage(); + a.index = index; + a.selected = index == audioSelected; + // 如果需要,还可以检查轨道的描述或标题以获取更多信息 + data.addAudio(a); } if (info.getTrackType() == ITrackInfo.MEDIA_TRACK_TYPE_TIMEDTEXT) {//内置字幕 TrackInfoBean t = new TrackInfoBean(); diff --git a/app/src/main/java/com/github/tvbox/osc/ui/activity/LivePlayActivity.java b/app/src/main/java/com/github/tvbox/osc/ui/activity/LivePlayActivity.java index 423220bb05..fa32e5566c 100644 --- a/app/src/main/java/com/github/tvbox/osc/ui/activity/LivePlayActivity.java +++ b/app/src/main/java/com/github/tvbox/osc/ui/activity/LivePlayActivity.java @@ -241,7 +241,7 @@ protected void init() { divEpg = (LinearLayout) findViewById(R.id.divEPG); //右上角图片旋转 objectAnimator = ObjectAnimator.ofFloat(iv_circle_bg,"rotation", 360.0f); - objectAnimator.setDuration(5000); + objectAnimator.setDuration(6000); objectAnimator.setRepeatCount(-1); objectAnimator.start(); @@ -507,7 +507,7 @@ private void showBottomEpg() { } if(!tip_epg1.getText().equals("暂无信息")){ ll_epg.setVisibility(View.VISIBLE); - countDownTimer = new CountDownTimer(5000, 1000) {//底部epg隐藏时间设定 + countDownTimer = new CountDownTimer(6000, 1000) {//底部epg隐藏时间设定 public void onTick(long j) { } public void onFinish() { @@ -536,7 +536,7 @@ public void run() { ll_right_top_loading.setVisibility(View.GONE); ll_right_top_huikan.setVisibility(View.GONE); } - }, 5000); + }, 6000); } } @@ -706,7 +706,7 @@ public void run() { public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); mHandler.removeCallbacks(mHideChannelListRun); - mHandler.postDelayed(mHideChannelListRun, 5000); + mHandler.postDelayed(mHideChannelListRun, 6000); } }); animator.start(); @@ -860,7 +860,7 @@ public void run() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); - mHandler.postDelayed(mHideSettingLayoutRun, 5000); + mHandler.postDelayed(mHideSettingLayoutRun, 6000); } }); animator.start(); @@ -902,7 +902,7 @@ private void initEpgListView() { public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); mHandler.removeCallbacks(mHideChannelListRun); - mHandler.postDelayed(mHideChannelListRun, 5000); + mHandler.postDelayed(mHideChannelListRun, 6000); } }); //电视 @@ -915,7 +915,7 @@ public void onItemPreSelected(TvRecyclerView parent, View itemView, int position @Override public void onItemSelected(TvRecyclerView parent, View itemView, int position) { mHandler.removeCallbacks(mHideChannelListRun); - mHandler.postDelayed(mHideChannelListRun, 5000); + mHandler.postDelayed(mHideChannelListRun, 6000); epgListAdapter.setFocusedEpgIndex(position); } @@ -1110,7 +1110,7 @@ private void initEpgDateView() { public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); mHandler.removeCallbacks(mHideChannelListRun); - mHandler.postDelayed(mHideChannelListRun, 5000); + mHandler.postDelayed(mHideChannelListRun, 6000); } }); @@ -1124,14 +1124,14 @@ public void onItemPreSelected(TvRecyclerView parent, View itemView, int position @Override public void onItemSelected(TvRecyclerView parent, View itemView, int position) { mHandler.removeCallbacks(mHideChannelListRun); - mHandler.postDelayed(mHideChannelListRun, 5000); + mHandler.postDelayed(mHideChannelListRun, 6000); liveEpgDateAdapter.setFocusedIndex(position); } @Override public void onItemClick(TvRecyclerView parent, View itemView, int position) { mHandler.removeCallbacks(mHideChannelListRun); - mHandler.postDelayed(mHideChannelListRun, 5000); + mHandler.postDelayed(mHideChannelListRun, 6000); liveEpgDateAdapter.setSelectedIndex(position); getEpg(liveEpgDateAdapter.getData().get(position).getDateParamVal()); } @@ -1143,7 +1143,7 @@ public void onItemClick(TvRecyclerView parent, View itemView, int position) { public void onItemClick(BaseQuickAdapter adapter, View view, int position) { FastClickCheckUtil.check(view); mHandler.removeCallbacks(mHideChannelListRun); - mHandler.postDelayed(mHideChannelListRun, 5000); + mHandler.postDelayed(mHideChannelListRun, 6000); liveEpgDateAdapter.setSelectedIndex(position); getEpg(liveEpgDateAdapter.getData().get(position).getDateParamVal()); } @@ -1182,12 +1182,12 @@ public void playStateChanged(int playState) { case VideoView.STATE_ERROR: case VideoView.STATE_PLAYBACK_COMPLETED: mHandler.removeCallbacks(mConnectTimeoutChangeSourceRun); - mHandler.postDelayed(mConnectTimeoutChangeSourceRun, 2000); + mHandler.postDelayed(mConnectTimeoutChangeSourceRun, 6000); break; case VideoView.STATE_PREPARING: case VideoView.STATE_BUFFERING: mHandler.removeCallbacks(mConnectTimeoutChangeSourceRun); - mHandler.postDelayed(mConnectTimeoutChangeSourceRun, (Hawk.get(HawkConfig.LIVE_CONNECT_TIMEOUT, 1) + 1) * 5000); + mHandler.postDelayed(mConnectTimeoutChangeSourceRun, (Hawk.get(HawkConfig.LIVE_CONNECT_TIMEOUT, 1) + 1) * 6000); break; } } @@ -1237,7 +1237,7 @@ private void initChannelGroupView() { public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); mHandler.removeCallbacks(mHideChannelListRun); - mHandler.postDelayed(mHideChannelListRun, 5000); + mHandler.postDelayed(mHideChannelListRun, 6000); } }); @@ -1285,7 +1285,7 @@ private void selectChannelGroup(int groupIndex, boolean focus, int liveChannelIn } if (tvLeftChannelListLayout.getVisibility() == View.VISIBLE) { mHandler.removeCallbacks(mHideChannelListRun); - mHandler.postDelayed(mHideChannelListRun, 5000); + mHandler.postDelayed(mHideChannelListRun, 6000); } } @@ -1300,7 +1300,7 @@ private void initLiveChannelView() { public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); mHandler.removeCallbacks(mHideChannelListRun); - mHandler.postDelayed(mHideChannelListRun, 5000); + mHandler.postDelayed(mHideChannelListRun, 6000); } }); @@ -1316,7 +1316,7 @@ public void onItemSelected(TvRecyclerView parent, View itemView, int position) { liveChannelGroupAdapter.setFocusedGroupIndex(-1); liveChannelItemAdapter.setFocusedChannelIndex(position); mHandler.removeCallbacks(mHideChannelListRun); - mHandler.postDelayed(mHideChannelListRun, 5000); + mHandler.postDelayed(mHideChannelListRun, 6000); } @Override @@ -1340,7 +1340,7 @@ private void clickLiveChannel(int position) { playChannel(liveChannelGroupAdapter.getSelectedGroupIndex(), position, false); if (tvLeftChannelListLayout.getVisibility() == View.VISIBLE) { mHandler.removeCallbacks(mHideChannelListRun); - mHandler.postDelayed(mHideChannelListRun, 5000); + mHandler.postDelayed(mHideChannelListRun, 6000); } } @@ -1355,7 +1355,7 @@ private void initSettingGroupView() { public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); mHandler.removeCallbacks(mHideSettingLayoutRun); - mHandler.postDelayed(mHideSettingLayoutRun, 5000); + mHandler.postDelayed(mHideSettingLayoutRun, 6000); } }); @@ -1412,7 +1412,7 @@ private void selectSettingGroup(int position, boolean focus) { if (scrollToPosition < 0) scrollToPosition = 0; mSettingItemView.scrollToPosition(scrollToPosition); mHandler.removeCallbacks(mHideSettingLayoutRun); - mHandler.postDelayed(mHideSettingLayoutRun, 5000); + mHandler.postDelayed(mHideSettingLayoutRun, 6000); } private void initSettingItemView() { @@ -1426,7 +1426,7 @@ private void initSettingItemView() { public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); mHandler.removeCallbacks(mHideSettingLayoutRun); - mHandler.postDelayed(mHideSettingLayoutRun, 5000); + mHandler.postDelayed(mHideSettingLayoutRun, 6000); } }); @@ -1442,7 +1442,7 @@ public void onItemSelected(TvRecyclerView parent, View itemView, int position) { liveSettingGroupAdapter.setFocusedGroupIndex(-1); liveSettingItemAdapter.setFocusedItemIndex(position); mHandler.removeCallbacks(mHideSettingLayoutRun); - mHandler.postDelayed(mHideSettingLayoutRun, 5000); + mHandler.postDelayed(mHideSettingLayoutRun, 6000); } @Override @@ -1511,7 +1511,7 @@ private void clickSettingItem(int position) { break; } mHandler.removeCallbacks(mHideSettingLayoutRun); - mHandler.postDelayed(mHideSettingLayoutRun, 5000); + mHandler.postDelayed(mHideSettingLayoutRun, 6000); } private void initLiveChannelList() { @@ -1720,7 +1720,7 @@ public void onChange(String password) { } if (tvLeftChannelListLayout.getVisibility() == View.VISIBLE) - mHandler.postDelayed(mHideChannelListRun, 5000); + mHandler.postDelayed(mHideChannelListRun, 6000); } @Override diff --git a/app/src/main/java/com/github/tvbox/osc/ui/activity/PlayActivity.java b/app/src/main/java/com/github/tvbox/osc/ui/activity/PlayActivity.java index 7287ece6ce..83b4f5bde6 100644 --- a/app/src/main/java/com/github/tvbox/osc/ui/activity/PlayActivity.java +++ b/app/src/main/java/com/github/tvbox/osc/ui/activity/PlayActivity.java @@ -499,7 +499,7 @@ public void run() { void playUrl(String url, HashMap headers) { LOG.i("playUrl:" + url); if(autoRetryCount>1 && url.contains(".m3u8")){ - url="http://home.jundie.top:666/unBom.php?m3u8="+url;//尝试去bom头再次播放 + //todo } final String finalUrl = url; runOnUiThread(new Runnable() { @@ -559,6 +559,7 @@ private void initSubtitleView() { ((IjkMediaPlayer)(mVideoView.getMediaPlayer())).setOnTimedTextListener(new IMediaPlayer.OnTimedTextListener() { @Override public void onTimedText(IMediaPlayer mp, IjkTimedText text) { + if(text==null)return; if (mController.mSubtitleView.isInternal) { com.github.tvbox.osc.subtitle.model.Subtitle subtitle = new com.github.tvbox.osc.subtitle.model.Subtitle(); subtitle.content = text.getText(); @@ -712,7 +713,7 @@ void initPlayerCfg() { mVodPlayerCfg.put("pr", Hawk.get(HawkConfig.PLAY_RENDER, 0)); } if (!mVodPlayerCfg.has("ijk")) { - mVodPlayerCfg.put("ijk", Hawk.get(HawkConfig.IJK_CODEC, "")); + mVodPlayerCfg.put("ijk", Hawk.get(HawkConfig.IJK_CODEC, "硬解码")); } if (!mVodPlayerCfg.has("sc")) { mVodPlayerCfg.put("sc", Hawk.get(HawkConfig.PLAY_SCALE, 0)); @@ -861,8 +862,8 @@ public void play(boolean reset) { stopParse(); initParseLoadFound(); if(mVideoView!=null) mVideoView.release(); - String subtitleCacheKey = mVodInfo.sourceKey + "-" + mVodInfo.id + "-" + mVodInfo.playFlag + "-" + mVodInfo.playIndex+ "-" + vs.name + "-subt"; - String progressKey = mVodInfo.sourceKey + mVodInfo.id + mVodInfo.playFlag + mVodInfo.playIndex + vs.name; + subtitleCacheKey = mVodInfo.sourceKey + "-" + mVodInfo.id + "-" + mVodInfo.playFlag + "-" + mVodInfo.playIndex+ "-" + vs.name + "-subt"; + progressKey = mVodInfo.sourceKey + mVodInfo.id + mVodInfo.playFlag + mVodInfo.playIndex + vs.name; //重新播放清除现有进度 if (reset) { CacheManager.delete(MD5.string2MD5(progressKey), 0); diff --git a/app/src/main/java/com/github/tvbox/osc/ui/adapter/FastSearchAdapter.java b/app/src/main/java/com/github/tvbox/osc/ui/adapter/FastSearchAdapter.java index 720afdfea1..4ebecf133b 100644 --- a/app/src/main/java/com/github/tvbox/osc/ui/adapter/FastSearchAdapter.java +++ b/app/src/main/java/com/github/tvbox/osc/ui/adapter/FastSearchAdapter.java @@ -39,7 +39,7 @@ protected void convert(BaseViewHolder helper, Movie.Video item) { .load(item.pic) .transform(new RoundTransformation(MD5.string2MD5(item.pic)) .centerCorp(true) - .override(AutoSizeUtils.mm2px(mContext, 300), AutoSizeUtils.mm2px(mContext, 400)) + .override(AutoSizeUtils.mm2px(mContext, 240), AutoSizeUtils.mm2px(mContext, 320)) .roundRadius(AutoSizeUtils.mm2px(mContext, 10), RoundTransformation.RoundType.ALL)) .placeholder(R.drawable.img_loading_placeholder) .noFade() diff --git a/app/src/main/java/com/github/tvbox/osc/ui/adapter/GridAdapter.java b/app/src/main/java/com/github/tvbox/osc/ui/adapter/GridAdapter.java index 788dea9dca..4207d69532 100644 --- a/app/src/main/java/com/github/tvbox/osc/ui/adapter/GridAdapter.java +++ b/app/src/main/java/com/github/tvbox/osc/ui/adapter/GridAdapter.java @@ -49,7 +49,7 @@ protected void convert(BaseViewHolder helper, Movie.Video item) { .roundRadius(AutoSizeUtils.mm2px(mContext, 10), RoundTransformation.RoundType.ALL)) .placeholder(R.drawable.img_loading_placeholder) .noFade() -// .error(R.drawable.img_loading_placeholder) + .error(R.drawable.img_loading_placeholder) .into(ivThumb); } else { ivThumb.setImageResource(R.drawable.img_loading_placeholder); @@ -100,7 +100,7 @@ protected void convert(BaseViewHolder helper, Movie.Video item) { .roundRadius(AutoSizeUtils.mm2px(mContext, 10), RoundTransformation.RoundType.ALL)) .placeholder(R.drawable.img_loading_placeholder) .noFade() -// .error(R.drawable.img_loading_placeholder) + .error(R.drawable.img_loading_placeholder) .into(ivThumb); } else { ivThumb.setImageResource(R.drawable.img_loading_placeholder); diff --git a/app/src/main/java/com/github/tvbox/osc/ui/fragment/ModelSettingFragment.java b/app/src/main/java/com/github/tvbox/osc/ui/fragment/ModelSettingFragment.java index b118ce92d8..13a4ddaade 100644 --- a/app/src/main/java/com/github/tvbox/osc/ui/fragment/ModelSettingFragment.java +++ b/app/src/main/java/com/github/tvbox/osc/ui/fragment/ModelSettingFragment.java @@ -107,7 +107,7 @@ protected void init() { tvHistoryNum = findViewById(R.id.tvHistoryNum); tvSearchView = findViewById(R.id.tvSearchView); tvIjkCachePlay = findViewById(R.id.tvIjkCachePlay); - tvMediaCodec.setText(Hawk.get(HawkConfig.IJK_CODEC, "")); + tvMediaCodec.setText(Hawk.get(HawkConfig.IJK_CODEC, "硬解码")); tvDebugOpen.setText(Hawk.get(HawkConfig.DEBUG_OPEN, false) ? "已打开" : "已关闭"); tvParseWebView.setText(Hawk.get(HawkConfig.PARSE_WEBVIEW, true) ? "系统自带" : "XWalkView"); tvApi.setText(Hawk.get(HawkConfig.API_URL, "")); @@ -309,7 +309,7 @@ public void onClick(View v) { FastClickCheckUtil.check(v); int defaultPos = 0; - String ijkSel = Hawk.get(HawkConfig.IJK_CODEC, ""); + String ijkSel = Hawk.get(HawkConfig.IJK_CODEC, "硬解码"); for (int j = 0; j < ijkCodes.size(); j++) { if (ijkSel.equals(ijkCodes.get(j).getName())) { defaultPos = j; diff --git a/app/src/main/java/com/github/tvbox/osc/ui/fragment/PlayFragment.java b/app/src/main/java/com/github/tvbox/osc/ui/fragment/PlayFragment.java index 3623e65833..49354a3081 100644 --- a/app/src/main/java/com/github/tvbox/osc/ui/fragment/PlayFragment.java +++ b/app/src/main/java/com/github/tvbox/osc/ui/fragment/PlayFragment.java @@ -510,7 +510,7 @@ public void run() { void playUrl(String url, HashMap headers) { LOG.i("playUrl:" + url); if(autoRetryCount>0 && url.contains(".m3u8")){ - url="http://home.jundie.top:666/unBom.php?m3u8="+url;//尝试去bom头再次播放 + // todo } if (mActivity == null) return; if (!isAdded()) return; @@ -572,6 +572,7 @@ private void initSubtitleView() { ((IjkMediaPlayer)(mVideoView.getMediaPlayer())).setOnTimedTextListener(new IMediaPlayer.OnTimedTextListener() { @Override public void onTimedText(IMediaPlayer mp, IjkTimedText text) { + if(text==null)return; if (mController.mSubtitleView.isInternal) { com.github.tvbox.osc.subtitle.model.Subtitle subtitle = new com.github.tvbox.osc.subtitle.model.Subtitle(); subtitle.content = text.getText(); @@ -610,6 +611,11 @@ public void onTimedText(IMediaPlayer mp, IjkTimedText text) { } } } +// if (trackInfo != null && trackInfo.getAudio().size()>0) { +// List audioTrackList = trackInfo.getAudio(); +//// int selectedIndex = trackInfo.getAudioSelected(false); +// ((IjkMediaPlayer)(mVideoView.getMediaPlayer())).setTrack(audioTrackList.get(0).index); +// } } private void initViewModel() { @@ -731,7 +737,7 @@ void initPlayerCfg() { mVodPlayerCfg.put("pr", Hawk.get(HawkConfig.PLAY_RENDER, 0)); } if (!mVodPlayerCfg.has("ijk")) { - mVodPlayerCfg.put("ijk", Hawk.get(HawkConfig.IJK_CODEC, "")); + mVodPlayerCfg.put("ijk", Hawk.get(HawkConfig.IJK_CODEC, "硬解码")); } if (!mVodPlayerCfg.has("sc")) { mVodPlayerCfg.put("sc", Hawk.get(HawkConfig.PLAY_SCALE, 0)); @@ -893,8 +899,8 @@ public void play(boolean reset) { stopParse(); initParseLoadFound(); if(mVideoView!=null) mVideoView.release(); - String subtitleCacheKey = mVodInfo.sourceKey + "-" + mVodInfo.id + "-" + mVodInfo.playFlag + "-" + mVodInfo.playIndex+ "-" + vs.name + "-subt"; - String progressKey = mVodInfo.sourceKey + mVodInfo.id + mVodInfo.playFlag + mVodInfo.playIndex + vs.name; + subtitleCacheKey = mVodInfo.sourceKey + "-" + mVodInfo.id + "-" + mVodInfo.playFlag + "-" + mVodInfo.playIndex+ "-" + vs.name + "-subt"; + progressKey = mVodInfo.sourceKey + mVodInfo.id + mVodInfo.playFlag + mVodInfo.playIndex + vs.name; //重新播放清除现有进度 if (reset) { CacheManager.delete(MD5.string2MD5(progressKey), 0); diff --git a/app/src/main/java/com/github/tvbox/osc/util/PlayerHelper.java b/app/src/main/java/com/github/tvbox/osc/util/PlayerHelper.java index c79b0c3043..5f99f9c26d 100644 --- a/app/src/main/java/com/github/tvbox/osc/util/PlayerHelper.java +++ b/app/src/main/java/com/github/tvbox/osc/util/PlayerHelper.java @@ -36,7 +36,7 @@ public static void updateCfg(VideoView videoView, JSONObject playerCfg) { public static void updateCfg(VideoView videoView, JSONObject playerCfg,int forcePlayerType) { int playerType = Hawk.get(HawkConfig.PLAY_TYPE, 0); int renderType = Hawk.get(HawkConfig.PLAY_RENDER, 0); - String ijkCode = Hawk.get(HawkConfig.IJK_CODEC, "软解码"); + String ijkCode = Hawk.get(HawkConfig.IJK_CODEC, "硬解码"); int scale = Hawk.get(HawkConfig.PLAY_SCALE, 0); try { playerType = playerCfg.getInt("pl"); diff --git a/app/src/main/java/com/github/tvbox/osc/util/XWalkUtils.java b/app/src/main/java/com/github/tvbox/osc/util/XWalkUtils.java index 6acaf60155..5f74553665 100644 --- a/app/src/main/java/com/github/tvbox/osc/util/XWalkUtils.java +++ b/app/src/main/java/com/github/tvbox/osc/util/XWalkUtils.java @@ -30,7 +30,7 @@ public interface XWalkState { public static String downUrl() { // return String.format("https://download.01.org/crosswalk/releases/crosswalk/android/stable/23.53.589.4/%s/crosswalk-apks-23.53.589.4-%s.zip", getRuntimeAbi(), getRuntimeAbi()); - return String.format("http://home.jundie.top:81/xwalk/maven2/crosswalk-apks-23.53.589.4-%s.zip", getRuntimeAbi()); + return String.format("http://diejun.f3322.net:81/xwalk/maven2/crosswalk-apks-23.53.589.4-%s.zip", getRuntimeAbi()); } public static String saveZipFile() { diff --git a/app/src/main/java/com/github/tvbox/osc/util/live/TxtSubscribe.java b/app/src/main/java/com/github/tvbox/osc/util/live/TxtSubscribe.java index 8750ea649e..fa6e678b11 100644 --- a/app/src/main/java/com/github/tvbox/osc/util/live/TxtSubscribe.java +++ b/app/src/main/java/com/github/tvbox/osc/util/live/TxtSubscribe.java @@ -8,9 +8,63 @@ import java.util.ArrayList; import java.util.LinkedHashMap; +import java.util.regex.Matcher; +import java.util.regex.Pattern; public class TxtSubscribe { + private static final Pattern NAME_PATTERN = Pattern.compile(".*,(.+?)$"); + private static final Pattern GROUP_PATTERN = Pattern.compile("group-title=\"(.*?)\""); + public static void parse(LinkedHashMap>> linkedHashMap, String str) { + if (str.startsWith("#EXTM3U")) { + parseM3u(linkedHashMap, str); + } else { + parseTxt(linkedHashMap, str); + } + } + private static void parseM3u(LinkedHashMap>> linkedHashMap, String str) { + ArrayList urls; + try { + BufferedReader bufferedReader = new BufferedReader(new StringReader(str)); + LinkedHashMap> channel = new LinkedHashMap<>(); + LinkedHashMap> channelTemp = channel; + String line; + while ((line = bufferedReader.readLine()) != null) { + if (line.equals("")) continue; + if (line.startsWith("#EXTM3U")) continue; + if (line.startsWith("#EXTINF")) { + String name = getStrByRegex(NAME_PATTERN, line); + String group = getStrByRegex(GROUP_PATTERN, line); + String url = bufferedReader.readLine().trim(); + if (linkedHashMap.containsKey(group)) { + channelTemp = linkedHashMap.get(group); + } else { + channelTemp = new LinkedHashMap<>(); + linkedHashMap.put(group, channelTemp); + } + if (null != channelTemp && channelTemp.containsKey(name)) { + urls = channelTemp.get(name); + } else { + urls = new ArrayList<>(); + channelTemp.put(name, urls); + } + if (null != urls && !urls.contains(url)) urls.add(url); + } + } + bufferedReader.close(); + if (channel.isEmpty()) return; + linkedHashMap.put("未分组", channel); + } catch (Exception e) { + e.printStackTrace(); + } + } + private static String getStrByRegex(Pattern pattern, String line) { + Matcher matcher = pattern.matcher(line); + if (matcher.find()) return matcher.group(1); + return pattern.pattern().equals(GROUP_PATTERN.pattern()) ? "未分组" : "未命名"; + } + + public static void parseTxt(LinkedHashMap>> linkedHashMap, String str) { ArrayList arrayList; try { BufferedReader bufferedReader = new BufferedReader(new StringReader(str)); diff --git a/app/src/main/java/com/github/tvbox/osc/viewmodel/SourceViewModel.java b/app/src/main/java/com/github/tvbox/osc/viewmodel/SourceViewModel.java index 718162d7d3..e6dbc74aba 100644 --- a/app/src/main/java/com/github/tvbox/osc/viewmodel/SourceViewModel.java +++ b/app/src/main/java/com/github/tvbox/osc/viewmodel/SourceViewModel.java @@ -105,7 +105,8 @@ public void run() { @Override public String call() throws Exception { Spider sp = ApiConfig.get().getCSP(sourceBean); - return sp.homeContent(true); + String json=sp.homeContent(true); + return json; } }); String sortJson = null; @@ -498,7 +499,9 @@ public void run() { Spider sp = ApiConfig.get().getCSP(sourceBean); List ids = new ArrayList<>(); ids.add(id); - json(detailResult, sp.detailContent(ids), sourceBean.getKey()); + String json=sp.detailContent(ids); + LOG.i("JSON:"+json); + json(detailResult, json, sourceBean.getKey()); } catch (Throwable th) { th.printStackTrace(); } @@ -535,7 +538,7 @@ public void onSuccess(Response response) { @Override public void onError(Response response) { super.onError(response); - detailResult.postValue(null); + json(detailResult, "", sourceBean.getKey()); } }); } else { @@ -1157,22 +1160,22 @@ private AbsXml xml(MutableLiveData result, String xml, String sourceKey) private AbsXml json(MutableLiveData result, String json, String sourceKey) { try { // 测试数据 - /*json = "{\n" + - "\t\"list\": [{\n" + - "\t\t\"vod_id\": \"137133\",\n" + - "\t\t\"vod_name\": \"磁力测试\",\n" + - "\t\t\"vod_pic\": \"https:/img9.doubanio.com/view/photo/s_ratio_poster/public/p2656327176.webp@User-Agent=com.douban.frodo\",\n" + - "\t\t\"type_name\": \"剧情 / 爱情 / 古装\",\n" + - "\t\t\"vod_year\": \"2022\",\n" + - "\t\t\"vod_area\": \"中国大陆\",\n" + - "\t\t\"vod_remarks\": \"40集全\",\n" + - "\t\t\"vod_actor\": \"刘亦菲\",\n" + - "\t\t\"vod_director\": \"杨阳\",\n" + - "\t\t\"vod_content\": \"  在钱塘开茶铺的赵盼儿(刘亦菲 饰)惊闻未婚夫、新科探花欧阳旭(徐海乔 饰)要另娶当朝高官之女,不甘命运的她誓要上京讨个公道。在途中她遇到了出自权门但生性正直的皇城司指挥顾千帆(陈晓 饰),并卷入江南一场大案,两人不打不相识从而结缘。赵盼儿凭借智慧解救了被骗婚而惨遭虐待的“江南第一琵琶高手”宋引章(林允 饰)与被苛刻家人逼得离家出走的豪爽厨娘孙三娘(柳岩 饰),三位姐妹从此结伴同行,终抵汴京,见识世间繁华。为了不被另攀高枝的欧阳旭从东京赶走,赵盼儿与宋引章、孙三娘一起历经艰辛,将小小茶坊一步步发展为汴京最大的酒楼,揭露了负心人的真面目,收获了各自的真挚感情和人生感悟,也为无数平凡女子推开了一扇平等救赎之门。\",\n" + - "\t\t\"vod_play_from\": \"磁力测试\",\n" + - "\t\t\"vod_play_url\": \"0$magnet:?xt=urn:btih:9e9358b946c427962533472efdd2efd9e9e38c67&dn=%e9%98%b3%e5%85%89%e7%94%b5%e5%bd%b1www.ygdy8.com.%e7%83%ad%e8%a1%80.2022.BD.1080P.%e9%9f%a9%e8%af%ad%e4%b8%ad%e8%8b%b1%e5%8f%8c%e5%ad%97.mkv&tr=udp%3a%2f%2ftracker.opentrackr.org%3a1337%2fannounce&tr=udp%3a%2f%2fexodus.desync.com%3a6969%2fannounce\"\n" + - "\t}]\n" + - "}";*/ +// json = "{\n" + +// "\t\"list\": [{\n" + +// "\t\t\"vod_id\": \"137133\",\n" + +// "\t\t\"vod_name\": \"磁力测试\",\n" + +// "\t\t\"vod_pic\": \"https:/img9.doubanio.com/view/photo/s_ratio_poster/public/p2656327176.webp\",\n" + +// "\t\t\"type_name\": \"剧情 / 爱情 / 古装\",\n" + +// "\t\t\"vod_year\": \"2022\",\n" + +// "\t\t\"vod_area\": \"中国大陆\",\n" + +// "\t\t\"vod_remarks\": \"40集全\",\n" + +// "\t\t\"vod_actor\": \"刘亦菲\",\n" + +// "\t\t\"vod_director\": \"杨阳\",\n" + +// "\t\t\"vod_content\": \"  在钱塘开茶铺的赵盼儿(刘亦菲 饰)惊闻未婚夫、新科探花欧阳旭(徐海乔 饰)要另娶当朝高官之女,不甘命运的她誓要上京讨个公道。在途中她遇到了出自权门但生性正直的皇城司指挥顾千帆(陈晓 饰),并卷入江南一场大案,两人不打不相识从而结缘。赵盼儿凭借智慧解救了被骗婚而惨遭虐待的“江南第一琵琶高手”宋引章(林允 饰)与被苛刻家人逼得离家出走的豪爽厨娘孙三娘(柳岩 饰),三位姐妹从此结伴同行,终抵汴京,见识世间繁华。为了不被另攀高枝的欧阳旭从东京赶走,赵盼儿与宋引章、孙三娘一起历经艰辛,将小小茶坊一步步发展为汴京最大的酒楼,揭露了负心人的真面目,收获了各自的真挚感情和人生感悟,也为无数平凡女子推开了一扇平等救赎之门。\",\n" + +// "\t\t\"vod_play_from\": \"磁力测试\",\n" + +// "\t\t\"vod_play_url\": \"0$magnet:?xt=urn:btih:e398ca38fb9d64897ed19b4d16efeea11af4d03b\"\n" + +// "\t}]\n" + +// "}"; AbsJson absJson = new Gson().fromJson(json, new TypeToken() { }.getType()); AbsXml data = absJson.toAbsXml(); diff --git a/build.gradle b/build.gradle index f6f9cabadd..64bacde238 100644 --- a/build.gradle +++ b/build.gradle @@ -5,12 +5,12 @@ buildscript { google() mavenCentral() maven { url "https://jitpack.io" } - //maven { url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2' } - maven { url 'http://home.jundie.top:81/xwalk/maven2' } -// maven { url 'http://9xi4o.tk/maven2' } + maven { url "https://maven.aliyun.com/repository/releases" } + maven { url "https://maven.aliyun.com/repository/public" } + maven { url "https://storage.googleapis.com/r8-releases/raw" } } dependencies { - classpath "com.android.tools.build:gradle:4.2.2" + classpath 'com.android.tools.build:gradle:4.2.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -19,13 +19,12 @@ buildscript { allprojects { repositories { - gradlePluginPortal() google() mavenCentral() maven { url "https://jitpack.io" } - //maven { url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2' } -// maven { url 'http://9xi4o.tk/maven2' } - maven { url 'http://home.jundie.top:81/xwalk/maven2' } + maven { url "https://maven.aliyun.com/repository/releases" } + maven { url "https://maven.aliyun.com/repository/public" } + gradlePluginPortal() } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 070478bcbc..2575a8c8af 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Tue Sep 21 09:53:05 CST 2021 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/player/build.gradle b/player/build.gradle index 002af46ea0..a9901066d4 100644 --- a/player/build.gradle +++ b/player/build.gradle @@ -8,8 +8,6 @@ android { defaultConfig { minSdkVersion 16 targetSdkVersion 26 - versionCode 1 - versionName "1.0" } buildTypes { diff --git a/player/src/main/java/tv/danmaku/ijk/media/player/IjkMediaPlayer.java b/player/src/main/java/tv/danmaku/ijk/media/player/IjkMediaPlayer.java index 3004c5c9a1..38f054184d 100644 --- a/player/src/main/java/tv/danmaku/ijk/media/player/IjkMediaPlayer.java +++ b/player/src/main/java/tv/danmaku/ijk/media/player/IjkMediaPlayer.java @@ -1049,15 +1049,20 @@ public void handleMessage(Message msg) { if (msg.obj == null) { player.notifyOnTimedText(null); } else { + String msg_text=(String) msg.obj; + if(msg_text.contains("{\\fad")){ + player.notifyOnTimedText(null); + return; + } if (msg.arg1 == 0) {// normal - IjkTimedText text = new IjkTimedText(new Rect(0, 0, 1, 1), (String) msg.obj); + IjkTimedText text = new IjkTimedText(new Rect(0, 0, 1, 1), msg_text); player.notifyOnTimedText(text); } else if (msg.arg1 == 1) { // ass - IjkTimedText text = new IjkTimedText(new Rect(0, 0, 1, 1), (String) msg.obj); + IjkTimedText text = new IjkTimedText(new Rect(0, 0, 1, 1), msg_text); player.notifyOnTimedText(text); } else if (msg.arg1 == 2) { // bitmap IjkTimedText text; - if (msg.arg2 > 0 && msg.obj instanceof int[] && ((int[]) msg.obj).length == msg.arg2) { + if (msg.arg2 > 0 && ((int[]) msg.obj).length == msg.arg2) { text = new IjkTimedText((int[]) msg.obj); } else { text = new IjkTimedText(null, ""); diff --git a/player/src/main/java/tv/danmaku/ijk/media/player/IjkTimedText.java b/player/src/main/java/tv/danmaku/ijk/media/player/IjkTimedText.java index 9b2268b5fe..2cd550bf2d 100644 --- a/player/src/main/java/tv/danmaku/ijk/media/player/IjkTimedText.java +++ b/player/src/main/java/tv/danmaku/ijk/media/player/IjkTimedText.java @@ -40,7 +40,9 @@ public IjkTimedText(Rect bounds, String text) { mTextChars = text; } - public IjkTimedText(int[] obj) { + + public IjkTimedText(int[] bitmap) { + this.mBitmapData = bitmap; } public Rect getBounds() { diff --git a/quickjs/build.gradle b/quickjs/build.gradle index 36138ff415..0004aaaf14 100644 --- a/quickjs/build.gradle +++ b/quickjs/build.gradle @@ -9,8 +9,6 @@ android { defaultConfig { minSdkVersion 16 targetSdkVersion 26 - versionCode 1 - versionName "1.0" externalNativeBuild { cmake { abiFilters 'armeabi-v7a'