Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected void onCreate(Bundle savedInstanceState) {
binding.danmakuPlayer.setEnlargeImageRes(R.drawable.custom_enlarge);

//String url = "https://res.exexm.com/cw_145225549855002";
String url = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4";
String url = "https://www.w3schools.com/html/mov_bbb.mp4";
//String url = "https://res.exexm.com/cw_145225549855002";
binding.danmakuPlayer.setUp(url, true, null, "测试视频");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ protected void onCreate(Bundle savedInstanceState) {

ArrayList<GSYSampleADVideoPlayer.GSYADVideoModel> urls = new ArrayList<>();
//广告1
urls.add(new GSYSampleADVideoPlayer.GSYADVideoModel("http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear3/prog_index.m3u8",
urls.add(new GSYSampleADVideoPlayer.GSYADVideoModel("https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8",
"", GSYSampleADVideoPlayer.GSYADVideoModel.TYPE_AD));
//正式内容1
urls.add(new GSYSampleADVideoPlayer.GSYADVideoModel("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4",
urls.add(new GSYSampleADVideoPlayer.GSYADVideoModel("https://www.w3schools.com/html/mov_bbb.mp4",
"正文1标题", GSYSampleADVideoPlayer.GSYADVideoModel.TYPE_NORMAL));
//广告2
urls.add(new GSYSampleADVideoPlayer.GSYADVideoModel("http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear3/prog_index.m3u8",
urls.add(new GSYSampleADVideoPlayer.GSYADVideoModel("https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8",
"", GSYSampleADVideoPlayer.GSYADVideoModel.TYPE_AD, true));
//正式内容2
urls.add(new GSYSampleADVideoPlayer.GSYADVideoModel("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4",
urls.add(new GSYSampleADVideoPlayer.GSYADVideoModel("https://www.w3schools.com/html/mov_bbb.mp4",
"正文2标题", GSYSampleADVideoPlayer.GSYADVideoModel.TYPE_NORMAL));

binding.adPlayer.setAdUp(urls, true, 0);
Expand Down Expand Up @@ -118,4 +118,3 @@ private void resolveNormalVideoUI() {
binding.adPlayer.getBackButton().setVisibility(View.VISIBLE);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
public class DetailControlActivity extends GSYBaseActivityDetail<StandardGSYVideoPlayer> {

//private final String url = "https://res.exexm.com/cw_145225549855002";
private final String url = "https://res.exexm.com/cw_145225549855002";
private final String url = "https://www.w3schools.com/html/mov_bbb.mp4";
//private String url = "http://livecdn1.news.cn/Live_MajorEvent01Phone/manifest.m3u8";
//private String url = "https://ruigongkao.oss-cn-shenzhen.aliyuncs.com/transcode/video/source/video/8908d124aa839d0d3fa9593855ef5957.m3u8";
//private String url2 = "http://ruigongkao.oss-cn-shenzhen.aliyuncs.com/transcode/video/source/video/3aca1a0db8db9418dcbc765848c8903e.m3u8";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class DetailDownloadExoPlayer extends AppCompatActivity {
private Map<String, String> header = new HashMap<>();


private String url = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4";
private String url = "https://www.w3schools.com/html/mov_bbb.mp4";

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ private GSYVideoPlayer getCurPlay() {

private String getUrl() {

String url = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4";
String url = "https://www.w3schools.com/html/mov_bbb.mp4";

return url;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public class DetailFilterActivity extends GSYBaseActivityDetail<StandardGSYVideo

private float deep = 0.8f;

private String url = "https://res.exexm.com/cw_145225549855002";
private String url = "https://www.w3schools.com/html/mov_bbb.mp4";
//private String url = "http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f20.mp4";

private Timer timer = new Timer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected void onCreate(Bundle savedInstanceState) {

//String url = "http://baobab.wd jcdn.com/14564977406580.mp4";
List<GSYVideoModel> urls = new ArrayList<>();
urls.add(new GSYVideoModel("http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear3/prog_index.m3u8", "标题1"));
urls.add(new GSYVideoModel("https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8", "标题1"));
// urls.add(new GSYVideoModel("https://res.exexm.com/cw_145225549855002", "标题2"));
// urls.add(new GSYVideoModel("http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear3/prog_index.m3u8", "标题3"));
// urls.add(new GSYVideoModel("https://res.exexm.com/cw_145225549855002", "标题4"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(rootView);


String source1 = "http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear1/prog_index.m3u8";
String source1 = "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8";
//String source1 = "https://res.exexm.com/cw_145225549855002";
String name = "普通";
SwitchVideoModel switchVideoModel = new SwitchVideoModel(name, source1);

String source2 = "http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear3/prog_index.m3u8";
String source2 = "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8";
String name2 = "清晰";
SwitchVideoModel switchVideoModel2 = new SwitchVideoModel(name2, source2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ public View getView(final int position, View convertView, ViewGroup parent) {
}


final String url = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4";
final String urlAD = "http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear3/prog_index.m3u8";
final String url = "https://www.w3schools.com/html/mov_bbb.mp4";
final String urlAD = "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8";

//多个播放时必须在setUpLazy、setUp和getGSYVideoManager()等前面设置
holder.gsyVideoPlayer.setPlayTag(TAG);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ public View getView(final int position, View convertView, ViewGroup parent) {
}


final String url = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4";
final String urlAD = "http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear3/prog_index.m3u8";
final String url = "https://www.w3schools.com/html/mov_bbb.mp4";
final String urlAD = "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8";

//多个播放时必须在setUpLazy、setUp和getGSYVideoManager()等前面设置
holder.gsyVideoPlayer.setPlayTag(TAG);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected void onCreate(Bundle savedInstanceState) {

initView();

String url = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4";
String url = "https://www.w3schools.com/html/mov_bbb.mp4";

//增加封面
ImageView imageView = new ImageView(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public StandardGSYVideoPlayer getGSYVideoPlayer() {

@Override
public GSYVideoOptionBuilder getGSYVideoOptionBuilder() {
String url = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4";
String url = "https://www.w3schools.com/html/mov_bbb.mp4";
//String url = "https://d131x7vzzf85jg.cloudfront.net/upload/documents/paper/b2/61/00/00/20160420_115018_b544.mp4";
//增加封面。内置封面可参考SampleCoverVideo
ImageView imageView = new ImageView(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ protected void onCreate(Bundle savedInstanceState) {

List<GSYVideoModel> urls = new ArrayList<>();

urls.add(new GSYVideoModel("http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear3/prog_index.m3u8", "标题1"));
urls.add(new GSYVideoModel("https://media6.smartstudy.com/ae/07/3997/2/dest.m3u8", "标题3"));
urls.add(new GSYVideoModel("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4", "标题2"));
urls.add(new GSYVideoModel("https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8", "标题1"));
urls.add(new GSYVideoModel("https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8", "标题3"));
urls.add(new GSYVideoModel("https://www.w3schools.com/html/mov_bbb.mp4", "标题2"));
//binding.detailPlayer.setUp(urls, 1);
binding.detailPlayer.setUp(urls, 0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.media.AudioManager;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
Expand Down Expand Up @@ -166,7 +165,7 @@ protected void startPrepare() {
getGSYVideoManager().setListener(this);
getGSYVideoManager().setPlayTag(mPlayTag);
getGSYVideoManager().setPlayPosition(mPlayPosition);
mAudioManager.requestAudioFocus(onAudioFocusChangeListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
// Audio focus is now handled by the base class GSYAudioFocusManager
try {
((Activity) getActivityContext()).getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
} catch (Exception e) {
Expand Down Expand Up @@ -261,7 +260,7 @@ public void onAutoCompletion() {

if (!mIfCurrentIsFullscreen)
getGSYVideoManager().setLastListener(null);
mAudioManager.abandonAudioFocus(onAudioFocusChangeListener);
// Audio focus is now handled by the base class GSYAudioFocusManager
if (mContext instanceof Activity) {
try {
((Activity) mContext).getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Expand Down Expand Up @@ -296,7 +295,7 @@ public void onCompletion() {
getGSYVideoManager().setCurrentVideoHeight(0);
getGSYVideoManager().setCurrentVideoWidth(0);

mAudioManager.abandonAudioFocus(onAudioFocusChangeListener);
// Audio focus is now handled by the base class GSYAudioFocusManager
if (mContext instanceof Activity) {
try {
((Activity) mContext).getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.media.AudioManager;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
Expand Down Expand Up @@ -68,7 +67,7 @@ protected void startPrepare() {
getGSYVideoManager().setListener(this);
getGSYVideoManager().setPlayTag(mPlayTag);
getGSYVideoManager().setPlayPosition(mPlayPosition);
mAudioManager.requestAudioFocus(onAudioFocusChangeListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
// Audio focus is now handled by the base class GSYAudioFocusManager
try {
if (mContext instanceof Activity) {
((Activity) mContext).getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ public void onBind(final int position, VideoModel videoModel) {
String url;
String title;
if (position % 2 == 0) {
url = "https://pointshow.oss-cn-hangzhou.aliyuncs.com/McTk51586843620689.mp4";
url = "https://www.w3schools.com/html/mov_bbb.mp4";
title = "这是title";
} else {
url = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4";
url = "https://www.w3schools.com/html/mov_bbb.mp4";
title = "哦?Title?";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ public void onBind(final int position, VideoModel videoModel) {
String url;
String title;
if (position % 2 == 0) {
url = "https://pointshow.oss-cn-hangzhou.aliyuncs.com/McTk51586843620689.mp4";
url = "https://www.w3schools.com/html/mov_bbb.mp4";
title = "这是title";
} else {
url = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4";
url = "https://www.w3schools.com/html/mov_bbb.mp4";
title = "哦?Title?";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected void onCreate(Bundle savedInstanceState) {

detailPlayer = (StandardGSYVideoPlayer) findViewById(R.id.detail_player);

String url = "http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear3/prog_index.m3u8";
String url = "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8";

//增加封面
ImageView imageView = new ImageView(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected void onCreate(Bundle savedInstanceState) {
private void init() {
videoPlayer = (StandardGSYVideoPlayer)findViewById(R.id.video_player);

String source1 = "http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear3/prog_index.m3u8";
String source1 = "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8";
videoPlayer.setUp(source1, true, "测试视频");

//增加封面
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public View getView(final int position, View convertView, ViewGroup parent) {
public void onClick(View v) {
notifyDataSetChanged();
smallVideoHelper.setPlayPositionAndTag(position, TAG);
final String url = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4";
final String url = "https://www.w3schools.com/html/mov_bbb.mp4";
gsySmallVideoHelperBuilder.setVideoTitle("title " + position)
.setUrl(url);
smallVideoHelper.startPlay();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public View getView(final int position, View convertView, ViewGroup parent) {
holder = (ViewHolder) convertView.getTag();
}

final String urlH = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4";
final String urlV = "http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear3/prog_index.m3u8";
final String urlH = "https://www.w3schools.com/html/mov_bbb.mp4";
final String urlV = "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8";
final String url = (position % 2 == 0) ? urlH : urlV;

if (position % 2 == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ public View getView(final int position, View convertView, ViewGroup parent) {
} else {
holder = (ViewHolder) convertView.getTag();
}
final String urlH = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4";
final String urlV = "http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear3/prog_index.m3u8";
final String urlH = "https://www.w3schools.com/html/mov_bbb.mp4";
final String urlV = "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8";
final String url = (position % 2 == 0) ? urlH : urlV;
final int coverId = (position % 2 == 0) ? R.mipmap.xxx1 : R.mipmap.xxx2;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.media.AudioManager;
import android.os.Build;
import android.util.AttributeSet;
import android.view.View;
Expand Down Expand Up @@ -62,7 +61,7 @@ protected void init(Context context) {
return;
mScreenWidth = getActivityContext().getResources().getDisplayMetrics().widthPixels;
mScreenHeight = getActivityContext().getResources().getDisplayMetrics().heightPixels;
mAudioManager = (AudioManager) getActivityContext().getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
// AudioManager is now handled by the base class GSYAudioFocusManager
mStartButton = findViewById(com.shuyu.gsyvideoplayer.R.id.start);
mStartButton.setOnClickListener(new OnClickListener() {
@Override
Expand All @@ -86,7 +85,7 @@ protected void startPrepare() {
getGSYVideoManager().setListener(this);
getGSYVideoManager().setPlayTag(mPlayTag);
getGSYVideoManager().setPlayPosition(mPlayPosition);
mAudioManager.requestAudioFocus(onAudioFocusChangeListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
// Audio focus is now handled by the base class GSYAudioFocusManager
//((Activity) getActivityContext()).getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
mBackUpPlayingBufferState = -1;
getGSYVideoManager().prepare(mUrl, mMapHeadData, mLooping, mSpeed, mCache, mCachePath, null);
Expand All @@ -105,7 +104,7 @@ public void onAutoCompletion() {

if (!mIfCurrentIsFullscreen)
getGSYVideoManager().setLastListener(null);
mAudioManager.abandonAudioFocus(onAudioFocusChangeListener);
// Audio focus is now handled by the base class GSYAudioFocusManager
//((Activity) getActivityContext()).getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

releaseNetWorkState();
Expand Down Expand Up @@ -134,7 +133,7 @@ public void onCompletion() {
getGSYVideoManager().setCurrentVideoHeight(0);
getGSYVideoManager().setCurrentVideoWidth(0);

mAudioManager.abandonAudioFocus(onAudioFocusChangeListener);
// Audio focus is now handled by the base class GSYAudioFocusManager
//((Activity) getActivityContext()).getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

releaseNetWorkState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.content.Context;
import android.graphics.Point;
import android.media.AudioManager;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.widget.ImageView;
Expand Down Expand Up @@ -53,23 +52,7 @@ protected void init(Context context) {
(mCurrentState == -1 || mCurrentState == CURRENT_STATE_NORMAL || mCurrentState == CURRENT_STATE_ERROR)) {
mThumbImageViewLayout.setVisibility(VISIBLE);
}
onAudioFocusChangeListener = new AudioManager.OnAudioFocusChangeListener() {
@Override
public void onAudioFocusChange(int focusChange) {
switch (focusChange) {
case AudioManager.AUDIOFOCUS_GAIN:
break;
case AudioManager.AUDIOFOCUS_LOSS:
//todo 判断如果不是外界造成的就不处理
break;
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
//todo 判断如果不是外界造成的就不处理
break;
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
break;
}
}
};
// Audio focus is now handled by the base class GSYAudioFocusManager
}

@Override
Expand Down Expand Up @@ -105,6 +88,23 @@ public int getLayoutId() {
return R.layout.video_layout_cover;
}

@Override
public void onAudioFocusGain() {

}

@Override
public void onAudioFocusLoss() {
}

@Override
public void onAudioFocusLossTransient() {
}

@Override
public void onAudioFocusLossTransientCanDuck() {
}

public void loadCoverImage(String url, int res) {
mCoverOriginUrl = url;
mDefaultRes = res;
Expand Down
Loading
Loading