|
|
|
|
@ -9,6 +9,7 @@ import android.os.Build; |
|
|
|
|
import android.os.Bundle; |
|
|
|
|
import android.os.Handler; |
|
|
|
|
import android.os.Message; |
|
|
|
|
import android.util.Base64; |
|
|
|
|
import android.view.KeyEvent; |
|
|
|
|
import android.view.View; |
|
|
|
|
import android.view.ViewGroup; |
|
|
|
|
@ -42,6 +43,7 @@ import com.github.tvbox.osc.bean.SourceBean; |
|
|
|
|
import com.github.tvbox.osc.bean.VodInfo; |
|
|
|
|
import com.github.tvbox.osc.cache.CacheManager; |
|
|
|
|
import com.github.tvbox.osc.event.RefreshEvent; |
|
|
|
|
import com.github.tvbox.osc.player.MyVideoView; |
|
|
|
|
import com.github.tvbox.osc.player.controller.VodController; |
|
|
|
|
import com.github.tvbox.osc.player.thirdparty.MXPlayer; |
|
|
|
|
import com.github.tvbox.osc.player.thirdparty.ReexPlayer; |
|
|
|
|
@ -81,10 +83,9 @@ import java.util.concurrent.Executors; |
|
|
|
|
|
|
|
|
|
import me.jessyan.autosize.AutoSize; |
|
|
|
|
import xyz.doikki.videoplayer.player.ProgressManager; |
|
|
|
|
import xyz.doikki.videoplayer.player.VideoView; |
|
|
|
|
|
|
|
|
|
public class PlayFragment extends BaseLazyFragment { |
|
|
|
|
private VideoView mVideoView; |
|
|
|
|
private MyVideoView mVideoView; |
|
|
|
|
private TextView mPlayLoadTip; |
|
|
|
|
private ImageView mPlayLoadErr; |
|
|
|
|
private ProgressBar mPlayLoading; |
|
|
|
|
@ -230,6 +231,14 @@ public class PlayFragment extends BaseLazyFragment { |
|
|
|
|
stopParse(); |
|
|
|
|
if (mVideoView != null) { |
|
|
|
|
mVideoView.release(); |
|
|
|
|
|
|
|
|
|
String zimuParamKey = "___zimu___"; //字幕url的header中key
|
|
|
|
|
String zimuBase64Url = ""; |
|
|
|
|
if (headers != null && headers.containsKey(zimuParamKey)) { |
|
|
|
|
zimuBase64Url = headers.get(zimuParamKey); |
|
|
|
|
headers.remove(zimuParamKey);//remove传过来的字幕header的key
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (url != null) { |
|
|
|
|
try { |
|
|
|
|
int playerType = mVodPlayerCfg.getInt("pl"); |
|
|
|
|
@ -264,6 +273,21 @@ public class PlayFragment extends BaseLazyFragment { |
|
|
|
|
} |
|
|
|
|
mVideoView.start(); |
|
|
|
|
mController.resetSpeed(); |
|
|
|
|
|
|
|
|
|
//加载字幕开始
|
|
|
|
|
String zimuUrl = ""; |
|
|
|
|
if (zimuBase64Url != null && zimuBase64Url.length() > 0) { |
|
|
|
|
zimuUrl = new String(Base64.decode(zimuBase64Url, Base64.DEFAULT)); |
|
|
|
|
mController.mSubtitleView.setVisibility(View.GONE); |
|
|
|
|
} |
|
|
|
|
if (zimuUrl != null && zimuUrl .length() > 0) { |
|
|
|
|
// 绑定MediaPlayer
|
|
|
|
|
mController.mSubtitleView.bindToMediaPlayer(mVideoView.getMediaPlayer()); |
|
|
|
|
// 设置字幕
|
|
|
|
|
mController.mSubtitleView.setSubtitlePath(zimuUrl); |
|
|
|
|
mController.mSubtitleView.setVisibility(View.VISIBLE); |
|
|
|
|
} |
|
|
|
|
//加载字幕结束
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|