Skip to content

Commit f2232a2

Browse files
author
archurtan
committed
【讯美项目支持】支持P2P本地录像下载
1、录像列表页面开发 2、下载功能 Change-Id: Ie88a3d730db33da6ce29bf7a0f2a4b12a5e9500c
1 parent dfd4910 commit f2232a2

File tree

10 files changed

+401
-78
lines changed

10 files changed

+401
-78
lines changed

sdk/video-link-android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ dependencies {
4848
// api('com.tencent.iot.thirdparty.android:xp2p-sdk:latest.integration') {
4949
// changing = true
5050
// }
51-
api 'com.tencent.iot.thirdparty.android:xp2p-sdk:2.4.21'
51+
api 'com.tencent.iot.thirdparty.android:xp2p-sdk:2.4.23-SNAPSHOT'
5252
api 'com.tencent.iot.thirdparty.android:media-server:1.0.0'
5353
}
5454

sdkdemo/src/main/java/com/tencent/iot/explorer/link/demo/video/Command.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ class Command {
6262
dateEnd.hours = 23
6363
dateEnd.minutes = 59
6464
dateEnd.seconds = 59
65-
return "action=inner_define&channel=${channel}&cmd=get_record_index" +
66-
"&start_time=${dateStart.time/1000}&end_time=${dateEnd.time/1000}"
65+
return "action=inner_define&channel=${channel}&cmd=get_file_list" +
66+
"&start_time=${dateStart.time/1000}&end_time=${dateEnd.time/1000}&file_type=0"
6767
}
6868

6969
fun getLocalVideoUrl(channel: Int, startTime: Long, endTime: Long): String {

sdkdemo/src/main/java/com/tencent/iot/explorer/link/demo/video/playback/CalendarDialog.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ public void onClick(View v) {
122122
onClickedListener.onOkClickedWithoutDateChecked();
123123
return;
124124
}
125-
if (calendar.getCheckedDate() != null && calendar.getCheckedDate().size() > 0 &&
126-
!allDate2Tag.containsAll(calendar.getCheckedDate())) {
127-
onClickedListener.onOkClickedCheckedDateWithoutData();
128-
return;
129-
}
125+
// if (calendar.getCheckedDate() != null && calendar.getCheckedDate().size() > 0 &&
126+
// !allDate2Tag.containsAll(calendar.getCheckedDate())) {
127+
// onClickedListener.onOkClickedCheckedDateWithoutData();
128+
// return;
129+
// }
130130
onClickedListener.onOkClicked(calendar.getCheckedDate());
131131
}
132132
dismiss();
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
package com.tencent.iot.explorer.link.demo.video.playback.localPlayback
2+
3+
import android.content.Context
4+
import android.view.LayoutInflater
5+
import android.view.View
6+
import android.view.ViewGroup
7+
import android.widget.ImageView
8+
import android.widget.TextView
9+
import androidx.recyclerview.widget.RecyclerView
10+
import com.tencent.iot.explorer.link.demo.R
11+
import java.text.SimpleDateFormat
12+
import java.util.*
13+
import kotlin.collections.ArrayList
14+
15+
class LocalPlaybackListAdapter(context: Context?, list: MutableList<PlaybackFile>) :
16+
RecyclerView.Adapter<LocalPlaybackListAdapter.ViewHolder>() {
17+
var list: MutableList<PlaybackFile> = ArrayList()
18+
var index = -1
19+
var context: Context? = null
20+
21+
init {
22+
this.list = list
23+
this.context = context
24+
}
25+
26+
class ViewHolder(layoutView: View) : RecyclerView.ViewHolder(layoutView) {
27+
var startTime: TextView
28+
var endTime: TextView
29+
var download: ImageView
30+
31+
init {
32+
startTime = layoutView.findViewById(R.id.tv_start_time)
33+
endTime = layoutView.findViewById(R.id.tv_end_time)
34+
download = layoutView.findViewById(R.id.iv_download)
35+
}
36+
}
37+
38+
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
39+
val view =
40+
LayoutInflater.from(parent.context).inflate(R.layout.item_playback_file, parent, false)
41+
return ViewHolder(view)
42+
}
43+
44+
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
45+
val sdf = SimpleDateFormat("HH:mm:ss")
46+
val formatStartTime: String = sdf.format(Date(list[position].start_time * 1000))
47+
val formatEndTime: String = sdf.format(Date(list[position].end_time * 1000))
48+
holder.startTime.text = formatStartTime
49+
holder.endTime.text = formatEndTime
50+
holder.download.setOnClickListener {
51+
onDownloadClicked?.onItemDownloadClicked(position)
52+
}
53+
holder.itemView.setOnClickListener {
54+
onItemClicked?.onItemClicked(position)
55+
}
56+
}
57+
58+
override fun getItemCount(): Int {
59+
if (list == null) return 0
60+
return list.size
61+
}
62+
63+
interface OnDownloadClickedListener {
64+
fun onItemDownloadClicked(pos: Int)
65+
}
66+
67+
private var onDownloadClicked: OnDownloadClickedListener? = null
68+
69+
fun setOnDownloadClickedListenter(onItemClicked: OnDownloadClickedListener?) {
70+
this.onDownloadClicked = onItemClicked
71+
}
72+
73+
interface OnItemClickedListener {
74+
fun onItemClicked(pos: Int)
75+
}
76+
77+
private var onItemClicked: OnItemClickedListener? = null
78+
79+
fun setOnItemClickedListener(onItemClicked: OnItemClickedListener?) {
80+
this.onItemClicked = onItemClicked
81+
}
82+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.tencent.iot.explorer.link.demo.video.playback.localPlayback
2+
3+
class PlaybackFile {
4+
var start_time = 0L
5+
var end_time = 0L
6+
var file_type = 0 //文件类型,整型值,取值0:视频,1:图片,其他:自定义
7+
var file_name = ""
8+
var file_size = 0L
9+
var extra_info = ""
10+
}

0 commit comments

Comments
 (0)