Skip to content

Commit

Permalink
更新 SDK 以及 Demo 到7.2.8925
Browse files Browse the repository at this point in the history
  • Loading branch information
wzyzb committed Apr 17, 2020
1 parent f9e2ab4 commit e171213
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 38 deletions.
4 changes: 4 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified app/libs/LiteAVSDK_Player.aar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public void onCreate(Bundle savedInstanceState) {
mActivityType = getIntent().getIntExtra("TYPE", ACTIVITY_TYPE_LIVE_PLAY);

mPlayConfig = new TXLivePlayConfig();
//mPlayConfig.setFlvSessionKey("X-Tlive-SpanId");

setContentView();

Expand Down Expand Up @@ -571,6 +572,9 @@ public void onPlayEvent(int event, Bundle param) {
}
Toast.makeText(getApplicationContext(), seiMessage, Toast.LENGTH_SHORT).show();
}
} else if (event == TXLiveConstants.PLAY_EVT_GET_FLVSESSIONKEY) {
//String flvSessionKey = param.getString(TXLiveConstants.EVT_DESCRIPTION, "");
//Toast.makeText(getApplicationContext(), "event PLAY_EVT_GET_FLVSESSIONKEY: " + flvSessionKey, Toast.LENGTH_SHORT).show();
}

if (event < 0) {
Expand Down
11 changes: 11 additions & 0 deletions lvb/src/main/res/layout/fragment_pusher_setting.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,18 @@
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"/>

<TextView
android:text="采集帧率"
android:textColor="@color/line_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<Spinner
android:id="@+id/pusher_spinner_fps"
android:entries="@array/video_fps"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"/>


<LinearLayout
Expand Down
Binary file modified player/libs/libsuperplayer.aar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import com.tencent.liteav.basic.log.TXCLog;
import com.tencent.liteav.demo.play.bean.TCPlayInfoStream;
import com.tencent.liteav.demo.play.protocol.TCPlayInfoParserV2;
import com.tencent.liteav.demo.play.protocol.TCPlayInfoParserV4;

import org.json.JSONArray;
import org.json.JSONException;
Expand All @@ -23,11 +25,11 @@

/**
* Created by liyuejiao on 2018/7/3.
* 获取点播信息
*/
* 获取点播信息
*/

public class SuperVodListLoader {

public static final int LOADINFO_ERROR_CODE_NORMAL = -1;
private static final String TAG = "SuperVodListLoader";
private static SuperVodListLoader sInstance;
private Handler mHandler;
Expand Down Expand Up @@ -66,23 +68,22 @@ public ArrayList<VideoModel> loadDefaultVodList() {
VideoModel model = null;



model = new VideoModel();
model.appid = 1252463788;
model.fileid = "5285890781763144364";
list.add(model);

model = new VideoModel();
model.appid = 1252463788;
model.fileid = "4564972819220421305";
model.appid = 1400329073;
model.fileid = "5285890800381567412";
list.add(model);

model = new VideoModel();
model.appid = 1252463788;
model.fileid = "4564972819219071568";
model.appid = 1400329073;
model.fileid = "5285890800381530399";
list.add(model);

model= new VideoModel();
model = new VideoModel();
model.appid = 1252463788;
model.fileid = "4564972819219071668";
list.add(model);
Expand All @@ -99,6 +100,7 @@ public ArrayList<VideoModel> loadDefaultVodList() {

return list;
}

public void getVodInfoOneByOne(ArrayList<VideoModel> videoModels) {
if (videoModels == null || videoModels.size() == 0)
return;
Expand All @@ -120,7 +122,7 @@ public void run() {
public void onFailure(Call call, IOException e) {
//获取请求信息失败
if (mOnVodInfoLoadListener != null) {
mOnVodInfoLoadListener.onFail(-1);
mOnVodInfoLoadListener.onFail(LOADINFO_ERROR_CODE_NORMAL);
}
}

Expand Down Expand Up @@ -149,7 +151,7 @@ public void run() {
public void onFailure(Call call, IOException e) {
//获取请求信息失败
if (listener != null) {
listener.onFail(-1);
listener.onFail(LOADINFO_ERROR_CODE_NORMAL);
}
}

Expand All @@ -162,29 +164,29 @@ public void onResponse(Call call, Response response) throws IOException {
if (code != 200) {
String message = jsonObject.getString("message");
if (listener != null) {
listener.onFail(-1);
listener.onFail(LOADINFO_ERROR_CODE_NORMAL);
}
TXCLog.e(TAG, message);
return;
}
JSONObject data = jsonObject.getJSONObject("data");
JSONArray liveList = data.getJSONArray("list");
ArrayList<VideoModel> modelList = new ArrayList<>();
for(int i = 0; i < liveList.length(); i++) {
for (int i = 0; i < liveList.length(); i++) {
JSONObject playItem = liveList.getJSONObject(i);
VideoModel model = new VideoModel();
model.appid = playItem.optInt("appId",0);
model.title = playItem.optString("name","");
model.placeholderImage = playItem.optString("coverUrl","");
model.appid = playItem.optInt("appId", 0);
model.title = playItem.optString("name", "");
model.placeholderImage = playItem.optString("coverUrl", "");

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

model.multiVideoURLs = new ArrayList<>(urlList.length());
model.videoURL = urlList.getJSONObject(0).optString("url","");
for(int j = 0; j < urlList.length(); j++) {
model.videoURL = urlList.getJSONObject(0).optString("url", "");
for (int j = 0; j < urlList.length(); j++) {
JSONObject urlItem = urlList.getJSONObject(j);
model.multiVideoURLs.add(new VideoModel.VideoPlayerURL(urlItem.optString("title",""),urlItem.optString("url","")));
model.multiVideoURLs.add(new VideoModel.VideoPlayerURL(urlItem.optString("title", ""), urlItem.optString("url", "")));
}
}

Expand All @@ -209,29 +211,53 @@ private void parseJson(VideoModel videoModel, String content) {
}
try {
JSONObject jsonObject = new JSONObject(content);
int code = jsonObject.getInt("code");
if (code != 0) {
String message = jsonObject.getString("message");
if (mOnVodInfoLoadListener != null) {
mOnVodInfoLoadListener.onFail(-1);
final int code = jsonObject.getInt("code");
final String message = jsonObject.optString("message");
final String warning = jsonObject.optString("warning");
TXCLog.i(TAG, "message: " + message);
TXCLog.i(TAG, "warning: " + warning);
if (code == 0) {
int version = jsonObject.getInt("version");
if (version == 2) {
PlayInfoResponseParser playInfoResponse = new PlayInfoResponseParser(jsonObject);
videoModel.placeholderImage = playInfoResponse.coverUrl();

TCPlayInfoStream stream = playInfoResponse.getSource();
if (stream != null) {
videoModel.duration = stream.getDuration();
}
videoModel.title = playInfoResponse.description();
if (videoModel.title == null || videoModel.title.length() == 0) {
videoModel.title = playInfoResponse.name();
}
if (mOnVodInfoLoadListener != null) {
mOnVodInfoLoadListener.onSuccess(videoModel);
}
return;
} else if (version == 4) {
JSONObject media = jsonObject.getJSONObject("media");
if (media != null) {
//解析视频名称
JSONObject basicInfo = media.optJSONObject("basicInfo");
if (basicInfo != null) {
videoModel.title = basicInfo.optString("description");
if (videoModel.title == null || videoModel.title.length() == 0) {
videoModel.title = basicInfo.optString("name");
}
videoModel.placeholderImage = basicInfo.optString("coverUrl");
videoModel.duration = basicInfo.optInt("duration");
}
if (mOnVodInfoLoadListener != null) {
mOnVodInfoLoadListener.onSuccess(videoModel);
}
return;
}
}
TXCLog.e(TAG, message);
return;
}
PlayInfoResponseParser playInfoResponse = new PlayInfoResponseParser(jsonObject);
videoModel.placeholderImage = playInfoResponse.coverUrl();

TCPlayInfoStream stream = playInfoResponse.getSource();
if (stream != null) {
videoModel.duration = stream.getDuration();
}
videoModel.title = playInfoResponse.description();
if (videoModel.title == null || videoModel.title.length() == 0) {
videoModel.title = playInfoResponse.name();
}
if (mOnVodInfoLoadListener != null) {
mOnVodInfoLoadListener.onSuccess(videoModel);
mOnVodInfoLoadListener.onFail(LOADINFO_ERROR_CODE_NORMAL);
}
return;
} catch (JSONException e) {
e.printStackTrace();
}
Expand Down

0 comments on commit e171213

Please sign in to comment.