Commit 297349c3 authored by zhangww's avatar zhangww
Browse files

3.16.4

1.添加图文打点功能
2.添加视频帧预览功能
parent b3a0e1f8
......@@ -61,7 +61,7 @@ dependencies {
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.bokecc:CCVOD:3.16.2'
implementation 'com.bokecc:CCVOD:3.16.4'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'com.umeng.umsdk:common:9.4.0'
......
......@@ -8,6 +8,7 @@
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />
......
......@@ -53,7 +53,7 @@ public class MainActivity extends AppCompatActivity {
private LinearLayout ll_retry;
private String verificationCode;
private Button btn_retry;
private static String[] PERMISSIONS_STORAGE = {
private static final String[] PERMISSIONS_STORAGE = {
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE};
private ArrayList<HuodeVideoInfo> videoDatas;
......
......@@ -93,6 +93,7 @@ import com.bokecc.sdk.mobile.exception.HuodeException;
import com.bokecc.sdk.mobile.play.AnswerSheetListener;
import com.bokecc.sdk.mobile.play.DWMediaPlayer;
import com.bokecc.sdk.mobile.play.DanmuInfo;
import com.bokecc.sdk.mobile.play.HotSpotInfo;
import com.bokecc.sdk.mobile.play.MarqueeAction;
import com.bokecc.sdk.mobile.play.MarqueeInfo;
import com.bokecc.sdk.mobile.play.MarqueeView;
......@@ -107,6 +108,7 @@ import com.bokecc.sdk.mobile.play.OnQAMsgListener;
import com.bokecc.sdk.mobile.play.OnSendDanmuListener;
import com.bokecc.sdk.mobile.play.OnVisitMsgListener;
import com.bokecc.sdk.mobile.play.PlayInfo;
import com.bokecc.sdk.mobile.play.ThumbnailsCallback;
import com.bokecc.vod.ConfigUtil;
import com.bokecc.vod.HuoDeApplication;
import com.bokecc.vod.R;
......@@ -179,6 +181,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Timer;
......@@ -820,6 +823,10 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
public void onIndicatorTouch(int currentPosition) {
player.seekTo(currentPosition * 1000);
seekToDanmu(currentPosition * 1000);
if (player != null && !player.isPlaying()) {
player.start();
iv_play_pause.setImageResource(R.mipmap.iv_pause);
}
}
});
......@@ -1285,6 +1292,14 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
}
});
//视频缩略图相关数据
player.setThumbnailsCallback(new ThumbnailsCallback() {
@Override
public void onThumbnailsInfo(List<String> thumbnailsList) {
sb_progress.setThumbnails(thumbnailsList);
}
});
//设置访客信息收集监听器
visitorInfos = new ArrayList<>();
player.setOnVisitMsgListener(new OnVisitMsgListener() {
......@@ -1371,6 +1386,11 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
}
}
}
@Override
public void onHotSpotInfo(LinkedHashMap<Integer, HotSpotInfo> hotSpotInfoList) {
sb_progress.setHotspotInfo(hotSpotInfoList);
}
});
// DRM加密播放
player.setDRMServerPort(HuoDeApplication.getDrmServerPort());
......@@ -3247,6 +3267,7 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
if (playInfo != null) {
playUrl = playInfo.getPlayUrl();
currentDefinition = playInfo.getDefaultDefinition();
sb_progress.setDuration(player.getDuration());
}
if (!isLocalPlay) {
if (playInfo != null && !TextUtils.isEmpty(playInfo.getCoverImage())) {
......@@ -3381,6 +3402,8 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
}
//运行跑马灯
mv_video.start();
//获取图文打点相关信息
player.executePortInfo();
}
@Override
......@@ -3651,6 +3674,8 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
//播放完成
@Override
public void onCompletion(MediaPlayer mp) {
sb_progress.dismissPopupWindow();
sb_progress.dismissPreview();
if (isSmallWindow) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
sendBroadcast(new Intent("com.bokecc.vod.play.SMALL_WINDOW").putExtra("control", 3));
......@@ -4844,26 +4869,21 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
player.stop();
player.release();
}
if (netReceiver != null) {
unregisterReceiver(netReceiver);
}
if (smallWindowReceiver != null) {
unregisterReceiver(smallWindowReceiver);
}
if (dm_view != null) {
dm_view.release();
dm_view = null;
}
if (isBindService) {
unbindService(serviceConnection);
ProjectionManager.getInstance().destroy();
ProjectionDeviceList.getInstance().destroy();
}
if (mTransportStateBroadcastReceiver != null) {
unregisterReceiver(mTransportStateBroadcastReceiver);
}
......@@ -4871,12 +4891,10 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
if (isProjectioning) {
stopProjection();
}
sensorManager.unregisterListener(this);
if (vibrator != null) {
vibrator.cancel();
}
}
//返回事件监听
......
......@@ -36,7 +36,6 @@ import android.os.IBinder;
import android.os.Message;
import android.os.Vibrator;
import android.text.TextUtils;
import android.util.Log;
import android.util.Rational;
import android.view.KeyEvent;
import android.view.MotionEvent;
......@@ -92,6 +91,7 @@ import com.bokecc.sdk.mobile.exception.HuodeException;
import com.bokecc.sdk.mobile.play.AnswerSheetListener;
import com.bokecc.sdk.mobile.play.DWIjkMediaPlayer;
import com.bokecc.sdk.mobile.play.DanmuInfo;
import com.bokecc.sdk.mobile.play.HotSpotInfo;
import com.bokecc.sdk.mobile.play.MarqueeAction;
import com.bokecc.sdk.mobile.play.MarqueeInfo;
import com.bokecc.sdk.mobile.play.MarqueeView;
......@@ -106,6 +106,7 @@ import com.bokecc.sdk.mobile.play.OnQAMsgListener;
import com.bokecc.sdk.mobile.play.OnSendDanmuListener;
import com.bokecc.sdk.mobile.play.OnVisitMsgListener;
import com.bokecc.sdk.mobile.play.PlayInfo;
import com.bokecc.sdk.mobile.play.ThumbnailsCallback;
import com.bokecc.vod.ConfigUtil;
import com.bokecc.vod.HuoDeApplication;
import com.bokecc.vod.R;
......@@ -180,6 +181,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Timer;
......@@ -792,6 +794,9 @@ public class SpeedPlayActivity extends Activity implements View.OnClickListener,
}
player.seekTo(stopPosition);
seekToDanmu(stopPosition);
if (player != null && !player.isPlaying()) {
player.start();
}
danmuSec = (stopPosition / GET_DAN_MU_INTERVAL) - 1;
//拖动进度条展示课堂练习
isShowConfirmExerciseDialog = isShowExercise(stopPosition);
......@@ -841,6 +846,9 @@ public class SpeedPlayActivity extends Activity implements View.OnClickListener,
public void onIndicatorTouch(int currentPosition) {
player.seekTo(currentPosition * 1000);
seekToDanmu(currentPosition * 1000);
if (player != null && !player.isPlaying()) {
player.start();
}
}
});
......@@ -1313,6 +1321,16 @@ public class SpeedPlayActivity extends Activity implements View.OnClickListener,
});
}
});
//视频缩略图相关数据
player.setThumbnailsCallback(new ThumbnailsCallback() {
@Override
public void onThumbnailsInfo(List<String> thumbnailsList) {
sb_progress.setThumbnails(thumbnailsList);
}
});
//设置访客信息收集监听器
visitorInfos = new ArrayList<>();
player.setOnVisitMsgListener(new OnVisitMsgListener() {
......@@ -1397,6 +1415,12 @@ public class SpeedPlayActivity extends Activity implements View.OnClickListener,
}
}
}
@Override
public void onHotSpotInfo(LinkedHashMap<Integer, HotSpotInfo> hotSpotInfoList) {
sb_progress.setHotspotInfo(hotSpotInfoList);
}
});
// DRM加密播放
player.setDRMServerPort(HuoDeApplication.getDrmServerPort());
......@@ -3311,6 +3335,7 @@ public class SpeedPlayActivity extends Activity implements View.OnClickListener,
if (playInfo != null) {
playUrl = playInfo.getPlayUrl();
currentDefinition = playInfo.getDefaultDefinition();
sb_progress.setDuration(player.getDuration());
}
isPrepared = true;
retryPlayTimes = 0;
......@@ -3420,6 +3445,8 @@ public class SpeedPlayActivity extends Activity implements View.OnClickListener,
}
//运行跑马灯
mv_video.start();
//获取图文打点相关信息
player.executePortInfo();
}
@Override
......@@ -3687,6 +3714,8 @@ public class SpeedPlayActivity extends Activity implements View.OnClickListener,
//播放完成
@Override
public void onCompletion(IMediaPlayer iMediaPlayer) {
sb_progress.dismissPopupWindow();
sb_progress.dismissPreview();
if (isSmallWindow) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
sendBroadcast(new Intent(PICTURE_IN_PICTURE_ACTION).putExtra("control", 3));
......@@ -3813,6 +3842,7 @@ public class SpeedPlayActivity extends Activity implements View.OnClickListener,
}
private void resetInfo() {
player.clearMediaData();
// 切换视频,重置questions
if (questions != null) {
questions.clear();
......@@ -3902,9 +3932,15 @@ public class SpeedPlayActivity extends Activity implements View.OnClickListener,
ll_load_video.setVisibility(View.VISIBLE);
hideOtherOperations();
tv_video_title.setText(videoTitle);
player.pause();
player.stop();
player.reset();
if (player != null) {
try {
player.pause();
player.stop();
player.reset();
} catch (IllegalStateException stateException) {
stateException.printStackTrace();
}
}
//当2倍速出现音视频不同步,且跟随播放时间增长,不同步情况更加明显时,可以设置以下Option
//音视频不同步,是因为cpu无法及时处理视频流信息所引起,这里做丢帧处理
//player.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "framedrop", 10);
......
......@@ -70,6 +70,7 @@ import com.bokecc.sdk.mobile.download.DownloadConfig;
import com.bokecc.sdk.mobile.download.VodDownloadManager;
import com.bokecc.sdk.mobile.exception.HuodeException;
import com.bokecc.sdk.mobile.play.DWMediaPlayer;
import com.bokecc.sdk.mobile.play.HotSpotInfo;
import com.bokecc.sdk.mobile.play.MarqueeInfo;
import com.bokecc.sdk.mobile.play.MediaMode;
import com.bokecc.sdk.mobile.play.OnAuthMsgListener;
......@@ -134,6 +135,7 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Timer;
......@@ -806,6 +808,12 @@ public class VrPlayActivity extends Activity implements View.OnClickListener,
public void onHotspots(TreeMap<Integer, String> hotspotMap) {
hotSpotDatas = hotspotMap;
}
@Override
public void onHotSpotInfo(LinkedHashMap<Integer, HotSpotInfo> hotSpotInfoList) {
}
});
// DRM加密播放
player.setDRMServerPort(HuoDeApplication.getDrmServerPort());
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#aa1e1f21" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle"
xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffff6e0a" />
</shape>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
android:layout_width="362dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical">
<RelativeLayout
android:background="@drawable/indicator_bg"
<LinearLayout
android:layout_width="362dp"
android:layout_height="170dp"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/preHotspot"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginEnd="5dp"
android:src="@drawable/pre_hotspot" />
<ImageView
android:id="@+id/hotspotImage"
android:layout_width="240dp"
android:layout_height="135dp"
android:scaleType="fitXY" />
<ImageView
android:id="@+id/nextHotspot"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="5dp"
android:src="@drawable/next_hotspot" />
</LinearLayout>
<LinearLayout
android:id="@+id/spotBottomRoot"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
android:background="@drawable/shape_hotspot"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/spotIndex"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_margin="5dp"
android:background="@drawable/shape_orange"
android:gravity="center"
android:paddingStart="7.5dp"
android:paddingEnd="7.5dp"
android:textColor="#ffffffff"
android:textSize="13sp" />
<TextView
android:id="@+id/spotTime"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:gravity="center"
android:textColor="#b3ffffff"
android:textSize="13sp" />
<TextView
android:maxWidth="240dp"
android:singleLine="true"
android:ellipsize="end"
android:id="@+id/hotspot_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_centerVertical="true"
android:text="aaa"
android:textColor="#e2ffffff"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:ellipsize="end"
android:maxWidth="260dp"
android:maxLines="2"
android:textColor="#ffffffff"
android:textSize="13sp" />
<ImageView
android:layout_centerVertical="true"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@id/hotspot_desc"
android:scaleType="centerInside"
android:src="@drawable/indicator_play_ic" />
</RelativeLayout>
<ImageView
android:id="@+id/arrow_indicator"
android:src="@drawable/arrow_ic"
android:scaleType="fitXY"
android:layout_gravity="center_horizontal"
android:layout_width="15dp"
android:layout_height="10dp" />
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="362dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/previewDuration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffff920a"
android:textSize="17sp" />
<TextView
android:id="@+id/durationText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffffff"
android:textSize="13sp" />
</LinearLayout>
<ImageView
android:id="@+id/previewImage"
android:layout_width="240dp"
android:layout_height="135dp"
android:scaleType="fitXY" />
<TextView
android:id="@+id/previewDesc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginStart="5dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
android:ellipsize="end"
android:gravity="center"
android:maxWidth="260dp"
android:maxLines="2"
android:textColor="#ffffffff"
android:textSize="13sp" />
</LinearLayout>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment