Skip to content

Commit

Permalink
Merge pull request #5 from OurEra/main
Browse files Browse the repository at this point in the history
Release for v1.0.1
  • Loading branch information
OurEra authored Jan 9, 2023
2 parents ad45cf4 + 6667ef5 commit 6460721
Show file tree
Hide file tree
Showing 20 changed files with 71 additions and 5,138 deletions.
6 changes: 3 additions & 3 deletions QNRTPlayerDemo/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.qiniu.droid.rtc.player.demo"
minSdkVersion 18
targetSdkVersion 28
versionCode 1
versionName "1.0"
versionCode 2
versionName "1.0.1"
buildConfigField "long", "BUILD_TIMESTAMP", System.currentTimeMillis() + "L"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -35,8 +35,8 @@ dependencies {
}

implementation files('libs/pldroid-media-streaming-3.0.1.jar')
implementation 'com.qiniu:happy-dns:0.2.18'
implementation 'com.squareup.okhttp3:okhttp:3.9.1'
implementation 'com.qiniu:happy-dns:0.2.17'
implementation 'de.greenrobot:eventbus:2.4.0'

implementation 'com.jakewharton:butterknife:8.8.1'
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ public void onClick(View v) {

SharedPreferences preferences = getSharedPreferences(getString(R.string.app_name), MODE_PRIVATE);
String roomName = preferences.getString(isStreamingType() ?
StreamingSettings.STREAMING_ROOMNAME : StreamingSettings.PLAYING_ROOMNAME, "http://pili-hls.qnsdk.com/sdk-live/timestamp.m3u8");
StreamingSettings.STREAMING_ROOMNAME : StreamingSettings.PLAYING_ROOMNAME,
isStreamingType() ? "testroom" : "http://pili-hls.qnsdk.com/sdk-live/timestamp.m3u8");
mAddressConfigEditText.setText(roomName);

if (isStreamingType()) {
mAddressConfigEditText.setHint(R.string.streaming_mode_hint);
mStartLivingButton.setText(R.string.streaming_mode_button_text);
Expand Down Expand Up @@ -107,13 +107,16 @@ public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
String playUrl = null;
if (roomName.matches(ROOM_NAME_REGEX)) {
mPublishUrl = QNAppServer.getInstance().requestPublishUrl(roomName);
playUrl = QNAppServer.getInstance().requestPlayUrl(roomName);
} else if (roomName.matches(URL_REGEX)) {
mPublishUrl = roomName;
} else {
mPublishUrl = null;
}
final String finalPlayUrl = playUrl;
runOnUiThread(new Runnable() {
@Override
public void run() {
Expand All @@ -126,6 +129,9 @@ public void run() {
}
Intent intent = new Intent(AddressConfigActivity.this, StreamingActivity.class);
intent.putExtra(Config.STREAMING_URL, mPublishUrl);
if (finalPlayUrl != null) {
intent.putExtra(Config.PLAYING_URL, finalPlayUrl);
}
startActivity(intent);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,17 @@
public class MainActivity extends AppCompatActivity {

private ProgressDialog mProgressDialog;

private PermissionChecker checker;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
checker = new PermissionChecker(this);

setContentView(R.layout.activity_main);

EventBus.getDefault().registerSticky(this);

checkUpdate();
}

Expand Down Expand Up @@ -77,14 +76,16 @@ public void onEvent(ProgressEvent progressEvent){
}

private boolean isPermissionOK() {
PermissionChecker checker = new PermissionChecker(this);
boolean isPermissionOK = Build.VERSION.SDK_INT < Build.VERSION_CODES.M || checker.checkPermission();
if (!isPermissionOK) {
ToastUtils.l(this, "Some permissions is not approved !!!");
}
return isPermissionOK;
}

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] state) {
super.onRequestPermissionsResult(requestCode, permissions, state);
checker.onRequestPermissionsResult(requestCode, permissions, state);
}

private void checkUpdate() {
new Thread(new Runnable() {
@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.qiniu.droid.rtplayer.demo.activity;

import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
Expand All @@ -12,6 +13,7 @@
import android.widget.TextView;

import com.qiniu.droid.rtplayer.QNConfiguration;
import com.qiniu.droid.rtplayer.QNDecodeMode;
import com.qiniu.droid.rtplayer.QNError;
import com.qiniu.droid.rtplayer.QNLogLevel;
import com.qiniu.droid.rtplayer.QNRTPlayer;
Expand All @@ -22,6 +24,7 @@
import com.qiniu.droid.rtplayer.QNSize;
import com.qiniu.droid.rtplayer.demo.R;
import com.qiniu.droid.rtplayer.demo.utils.Config;
import com.qiniu.droid.rtplayer.demo.utils.StreamingSettings;
import com.qiniu.droid.rtplayer.demo.utils.ToastUtils;
import com.qiniu.droid.rtplayer.render.QNSurfaceView;
import com.qiniu.droid.rtplayer.render.QNTextureView;
Expand Down Expand Up @@ -80,9 +83,13 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
mRTUrl.setURL(videoPath);
Log.i(TAG, "video path:" + videoPath);

SharedPreferences preferences = getSharedPreferences(getString(R.string.app_name), MODE_PRIVATE);
QNDecodeMode decodeMode = preferences.getBoolean(StreamingSettings.SW_ENABLE, false)
? QNDecodeMode.SOFTWARE : QNDecodeMode.HARDWARE;
mRTPlayer = QNRTPlayerFactory.createQNRTPlayer(getApplicationContext());
mRTPlayerSetting = new QNRTPlayerSetting();
mRTPlayerSetting.setLogLevel(QNLogLevel.INFO);
mRTPlayerSetting.setDecodeMode(decodeMode);
mRTPlayer.initPlayer(mRTPlayerSetting);
mRTPlayer.setEventListener(new RTPlayerListener());
mRTPlayer.setSurfaceRenderWindow(mRenderView);
Expand Down Expand Up @@ -184,6 +191,15 @@ public void run() {
mLogText.setText(text);

mMainHandler.postDelayed(this, 1000);
if (mProgressBar.getVisibility() != View.GONE && (mStats != null && mStats.audioBitrate > 0)) {
mMainHandler.postDelayed(new Runnable() {
@Override
public void run() {
// 纯音频流
mProgressBar.setVisibility(View.GONE);
}
}, 3000);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public class StreamingActivity extends AppCompatActivity {
private int mEncodingWidth;
private int mEncodingHeight;
private String mRoomName;
private String mPlayUrl;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
Expand All @@ -78,6 +79,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {

SharedPreferences preferences = getSharedPreferences(getString(R.string.app_name), MODE_PRIVATE);
mRoomName = preferences.getString(StreamingSettings.STREAMING_ROOMNAME, "");
mPlayUrl = getIntent().getStringExtra(Config.PLAYING_URL);
mIsQuicEnabled = preferences.getBoolean(StreamingSettings.QUIC_ENABLE, false);

CameraStreamingSetting.CAMERA_FACING_ID facingId = chooseCameraFacingId();
Expand Down Expand Up @@ -195,7 +197,16 @@ public void onClickSwitchCamera(View v) {
}

public void onClickCopyRoomName(View v) {

if (mPlayUrl == null) {
ToastUtils.s(this, getString(R.string.cannot_toggle_light_in_front));
} else {
ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
if (cm != null) {
ClipData clipData = ClipData.newPlainText("Label", mPlayUrl);
cm.setPrimaryClip(clipData);
}
ToastUtils.s(this, String.format(getString(R.string.copy_to_clipboard), mPlayUrl));
}
}

public void onClickToggleLight(View v) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void onRequestPermissionsResult(int requestCode, String[] permissions, in
// all permissions granted
} else {
// some permissions denied
//ToastUtils.s(mActivity, "some permissions denied");
ToastUtils.l(mActivity, "Some permissions is not approved !!!");
}
}
}
Expand Down
Binary file modified QNRTPlayerDemo/app/src/main/jniLibs/arm64-v8a/libqndroid_rtc.so
Binary file not shown.
Binary file not shown.
Binary file modified QNRTPlayerDemo/app/src/main/jniLibs/x86/libqndroid_rtc.so
Binary file not shown.
3 changes: 2 additions & 1 deletion QNRTPlayerDemo/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
<string name="streaming_log_text">推流协议:%1$s\n推流分辨率:%2$d x %3$d\n视频码率:%4$d kbps\n音频码率:%5$d kbps\n视频帧率:%6$d fps\n音频帧率:%7$d fps</string>
<string name="playing_log_text">卡顿次数:%1$d\n分辨率:%2$d x %3$d\n视频码率:%4$d kbps\n视频帧率:%5$d fps</string>
<string name="buffering">Buffering</string>
<string name="copy_to_clipboard">房间名:%1$s 复制到剪贴板</string>
<string name="copy_to_clipboard">%1$s 复制到剪贴板</string>
<string name="cannot_copy_play_url">原始推流地址,请自行确认播放地址</string>
<string name="android_auto_update_download_progress">正在下载:%1$d%%</string>
<string name="android_auto_update_dialog_btn_download">立即下载</string>
<string name="android_auto_update_dialog_btn_cancel">以后再说</string>
Expand Down
Binary file modified QNRTPlayerDemo/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions QNRTPlayerDemo/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Wed Jan 06 16:47:34 CST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
20 changes: 20 additions & 0 deletions ReleaseNotes/release-notes-1.0.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# QNRTPlayer Release Notes for 1.0.1

## 简介

七牛低延时直播(Geek)直播构建了全新的低延时直播互动体验,相比于传统的直播能力降低了延时、优化了协议与底层技术,目前对于微信内直播多业务场景提供了更为优渥的使用体验。支持千万级并发同时拥有毫秒级开播体验,打通了用户对于直播低延时性的核心诉求。

## 版本

- 发布 qndroid-rtplayer-1.0.1.jar
- 发布 qndroid-rtplayer-1.0.1-withrtc.jar
- 更新 libqndroid_rtc.so


## 功能

- 支持设置软解码模式播放

## 缺陷

- 修复流断开时播放状态没有回到 STATE_ERROR 的问题
Binary file modified releases/arm64-v8a/libqndroid_rtc.so
Binary file not shown.
Binary file modified releases/armeabi-v7a/libqndroid_rtc.so
Binary file not shown.
Loading

0 comments on commit 6460721

Please sign in to comment.