Skip to content

Commit e171213

Browse files
committed
更新 SDK 以及 Demo 到7.2.8925
1 parent f9e2ab4 commit e171213

File tree

6 files changed

+83
-38
lines changed

6 files changed

+83
-38
lines changed

.idea/modules.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/libs/LiteAVSDK_Player.aar

-22.5 KB
Binary file not shown.

lvb/src/main/java/com/tencent/liteav/demo/lvb/liveplayer/LivePlayerActivity.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ public void onCreate(Bundle savedInstanceState) {
134134
mActivityType = getIntent().getIntExtra("TYPE", ACTIVITY_TYPE_LIVE_PLAY);
135135

136136
mPlayConfig = new TXLivePlayConfig();
137+
//mPlayConfig.setFlvSessionKey("X-Tlive-SpanId");
137138

138139
setContentView();
139140

@@ -571,6 +572,9 @@ public void onPlayEvent(int event, Bundle param) {
571572
}
572573
Toast.makeText(getApplicationContext(), seiMessage, Toast.LENGTH_SHORT).show();
573574
}
575+
} else if (event == TXLiveConstants.PLAY_EVT_GET_FLVSESSIONKEY) {
576+
//String flvSessionKey = param.getString(TXLiveConstants.EVT_DESCRIPTION, "");
577+
//Toast.makeText(getApplicationContext(), "event PLAY_EVT_GET_FLVSESSIONKEY: " + flvSessionKey, Toast.LENGTH_SHORT).show();
574578
}
575579

576580
if (event < 0) {

lvb/src/main/res/layout/fragment_pusher_setting.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,18 @@
4646
android:layout_height="wrap_content"
4747
android:layout_marginBottom="2dp"/>
4848

49+
<TextView
50+
android:text="采集帧率"
51+
android:textColor="@color/line_btn"
52+
android:layout_width="match_parent"
53+
android:layout_height="wrap_content" />
4954

55+
<Spinner
56+
android:id="@+id/pusher_spinner_fps"
57+
android:entries="@array/video_fps"
58+
android:layout_width="match_parent"
59+
android:layout_height="wrap_content"
60+
android:layout_marginBottom="2dp"/>
5061

5162

5263
<LinearLayout

player/libs/libsuperplayer.aar

-61 Bytes
Binary file not shown.

player/src/main/java/com/tencent/liteav/demo/player/superplayer/SuperVodListLoader.java

Lines changed: 64 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
import com.tencent.liteav.basic.log.TXCLog;
88
import com.tencent.liteav.demo.play.bean.TCPlayInfoStream;
9+
import com.tencent.liteav.demo.play.protocol.TCPlayInfoParserV2;
10+
import com.tencent.liteav.demo.play.protocol.TCPlayInfoParserV4;
911

1012
import org.json.JSONArray;
1113
import org.json.JSONException;
@@ -23,11 +25,11 @@
2325

2426
/**
2527
* Created by liyuejiao on 2018/7/3.
26-
* 获取点播信息
27-
*/
28+
* 获取点播信息
29+
*/
2830

2931
public class SuperVodListLoader {
30-
32+
public static final int LOADINFO_ERROR_CODE_NORMAL = -1;
3133
private static final String TAG = "SuperVodListLoader";
3234
private static SuperVodListLoader sInstance;
3335
private Handler mHandler;
@@ -66,23 +68,22 @@ public ArrayList<VideoModel> loadDefaultVodList() {
6668
VideoModel model = null;
6769

6870

69-
7071
model = new VideoModel();
7172
model.appid = 1252463788;
7273
model.fileid = "5285890781763144364";
7374
list.add(model);
7475

7576
model = new VideoModel();
76-
model.appid = 1252463788;
77-
model.fileid = "4564972819220421305";
77+
model.appid = 1400329073;
78+
model.fileid = "5285890800381567412";
7879
list.add(model);
7980

8081
model = new VideoModel();
81-
model.appid = 1252463788;
82-
model.fileid = "4564972819219071568";
82+
model.appid = 1400329073;
83+
model.fileid = "5285890800381530399";
8384
list.add(model);
8485

85-
model= new VideoModel();
86+
model = new VideoModel();
8687
model.appid = 1252463788;
8788
model.fileid = "4564972819219071668";
8889
list.add(model);
@@ -99,6 +100,7 @@ public ArrayList<VideoModel> loadDefaultVodList() {
99100

100101
return list;
101102
}
103+
102104
public void getVodInfoOneByOne(ArrayList<VideoModel> videoModels) {
103105
if (videoModels == null || videoModels.size() == 0)
104106
return;
@@ -120,7 +122,7 @@ public void run() {
120122
public void onFailure(Call call, IOException e) {
121123
//获取请求信息失败
122124
if (mOnVodInfoLoadListener != null) {
123-
mOnVodInfoLoadListener.onFail(-1);
125+
mOnVodInfoLoadListener.onFail(LOADINFO_ERROR_CODE_NORMAL);
124126
}
125127
}
126128

@@ -149,7 +151,7 @@ public void run() {
149151
public void onFailure(Call call, IOException e) {
150152
//获取请求信息失败
151153
if (listener != null) {
152-
listener.onFail(-1);
154+
listener.onFail(LOADINFO_ERROR_CODE_NORMAL);
153155
}
154156
}
155157

@@ -162,29 +164,29 @@ public void onResponse(Call call, Response response) throws IOException {
162164
if (code != 200) {
163165
String message = jsonObject.getString("message");
164166
if (listener != null) {
165-
listener.onFail(-1);
167+
listener.onFail(LOADINFO_ERROR_CODE_NORMAL);
166168
}
167169
TXCLog.e(TAG, message);
168170
return;
169171
}
170172
JSONObject data = jsonObject.getJSONObject("data");
171173
JSONArray liveList = data.getJSONArray("list");
172174
ArrayList<VideoModel> modelList = new ArrayList<>();
173-
for(int i = 0; i < liveList.length(); i++) {
175+
for (int i = 0; i < liveList.length(); i++) {
174176
JSONObject playItem = liveList.getJSONObject(i);
175177
VideoModel model = new VideoModel();
176-
model.appid = playItem.optInt("appId",0);
177-
model.title = playItem.optString("name","");
178-
model.placeholderImage = playItem.optString("coverUrl","");
178+
model.appid = playItem.optInt("appId", 0);
179+
model.title = playItem.optString("name", "");
180+
model.placeholderImage = playItem.optString("coverUrl", "");
179181

180182
JSONArray urlList = playItem.getJSONArray("playUrl");
181183
if (urlList.length() > 0) {
182184

183185
model.multiVideoURLs = new ArrayList<>(urlList.length());
184-
model.videoURL = urlList.getJSONObject(0).optString("url","");
185-
for(int j = 0; j < urlList.length(); j++) {
186+
model.videoURL = urlList.getJSONObject(0).optString("url", "");
187+
for (int j = 0; j < urlList.length(); j++) {
186188
JSONObject urlItem = urlList.getJSONObject(j);
187-
model.multiVideoURLs.add(new VideoModel.VideoPlayerURL(urlItem.optString("title",""),urlItem.optString("url","")));
189+
model.multiVideoURLs.add(new VideoModel.VideoPlayerURL(urlItem.optString("title", ""), urlItem.optString("url", "")));
188190
}
189191
}
190192

@@ -209,29 +211,53 @@ private void parseJson(VideoModel videoModel, String content) {
209211
}
210212
try {
211213
JSONObject jsonObject = new JSONObject(content);
212-
int code = jsonObject.getInt("code");
213-
if (code != 0) {
214-
String message = jsonObject.getString("message");
215-
if (mOnVodInfoLoadListener != null) {
216-
mOnVodInfoLoadListener.onFail(-1);
214+
final int code = jsonObject.getInt("code");
215+
final String message = jsonObject.optString("message");
216+
final String warning = jsonObject.optString("warning");
217+
TXCLog.i(TAG, "message: " + message);
218+
TXCLog.i(TAG, "warning: " + warning);
219+
if (code == 0) {
220+
int version = jsonObject.getInt("version");
221+
if (version == 2) {
222+
PlayInfoResponseParser playInfoResponse = new PlayInfoResponseParser(jsonObject);
223+
videoModel.placeholderImage = playInfoResponse.coverUrl();
224+
225+
TCPlayInfoStream stream = playInfoResponse.getSource();
226+
if (stream != null) {
227+
videoModel.duration = stream.getDuration();
228+
}
229+
videoModel.title = playInfoResponse.description();
230+
if (videoModel.title == null || videoModel.title.length() == 0) {
231+
videoModel.title = playInfoResponse.name();
232+
}
233+
if (mOnVodInfoLoadListener != null) {
234+
mOnVodInfoLoadListener.onSuccess(videoModel);
235+
}
236+
return;
237+
} else if (version == 4) {
238+
JSONObject media = jsonObject.getJSONObject("media");
239+
if (media != null) {
240+
//解析视频名称
241+
JSONObject basicInfo = media.optJSONObject("basicInfo");
242+
if (basicInfo != null) {
243+
videoModel.title = basicInfo.optString("description");
244+
if (videoModel.title == null || videoModel.title.length() == 0) {
245+
videoModel.title = basicInfo.optString("name");
246+
}
247+
videoModel.placeholderImage = basicInfo.optString("coverUrl");
248+
videoModel.duration = basicInfo.optInt("duration");
249+
}
250+
if (mOnVodInfoLoadListener != null) {
251+
mOnVodInfoLoadListener.onSuccess(videoModel);
252+
}
253+
return;
254+
}
217255
}
218-
TXCLog.e(TAG, message);
219-
return;
220-
}
221-
PlayInfoResponseParser playInfoResponse = new PlayInfoResponseParser(jsonObject);
222-
videoModel.placeholderImage = playInfoResponse.coverUrl();
223-
224-
TCPlayInfoStream stream = playInfoResponse.getSource();
225-
if (stream != null) {
226-
videoModel.duration = stream.getDuration();
227-
}
228-
videoModel.title = playInfoResponse.description();
229-
if (videoModel.title == null || videoModel.title.length() == 0) {
230-
videoModel.title = playInfoResponse.name();
231256
}
232257
if (mOnVodInfoLoadListener != null) {
233-
mOnVodInfoLoadListener.onSuccess(videoModel);
258+
mOnVodInfoLoadListener.onFail(LOADINFO_ERROR_CODE_NORMAL);
234259
}
260+
return;
235261
} catch (JSONException e) {
236262
e.printStackTrace();
237263
}

0 commit comments

Comments
 (0)