Commit 6e73e81be8cd10b7d2afe3bdf2c00c789c1be7e8
1 parent
712a075f
修改推流demo
Showing
24 changed files
with
166 additions
and
400 deletions
app/libs/libcnlivestream.jar
No preview for this file type
app/libs/libcnliveutil.jar
No preview for this file type
app/src/main/AndroidManifest.xml
| @@ -24,16 +24,15 @@ | @@ -24,16 +24,15 @@ | ||
| 24 | android:label="@string/app_name" | 24 | android:label="@string/app_name" |
| 25 | android:supportsRtl="true" | 25 | android:supportsRtl="true" |
| 26 | android:theme="@style/AppTheme"> | 26 | android:theme="@style/AppTheme"> |
| 27 | - <activity android:name="com.cnlive.demo.stream.MainActivity"> | 27 | + <activity android:name=".MainActivity"> |
| 28 | <intent-filter> | 28 | <intent-filter> |
| 29 | <action android:name="android.intent.action.MAIN" /> | 29 | <action android:name="android.intent.action.MAIN" /> |
| 30 | 30 | ||
| 31 | <category android:name="android.intent.category.LAUNCHER" /> | 31 | <category android:name="android.intent.category.LAUNCHER" /> |
| 32 | </intent-filter> | 32 | </intent-filter> |
| 33 | </activity> | 33 | </activity> |
| 34 | - | ||
| 35 | <activity | 34 | <activity |
| 36 | - android:name="com.cnlive.demo.stream.StreamActivity" | 35 | + android:name=".StreamActivity" |
| 37 | android:configChanges="orientation|keyboardHidden|screenSize" | 36 | android:configChanges="orientation|keyboardHidden|screenSize" |
| 38 | android:launchMode="singleTop" | 37 | android:launchMode="singleTop" |
| 39 | android:screenOrientation="portrait" /> | 38 | android:screenOrientation="portrait" /> |
app/src/main/java/com/cnlive/demo/stream/MainActivity.java
| @@ -22,21 +22,10 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe | @@ -22,21 +22,10 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe | ||
| 22 | 22 | ||
| 23 | private static final String TAG = MainActivity.class.getSimpleName(); | 23 | private static final String TAG = MainActivity.class.getSimpleName(); |
| 24 | private Button mConnectButton; | 24 | private Button mConnectButton; |
| 25 | - private EditText mFrameRateEditText; | ||
| 26 | - private EditText mVideoBitRateEditText; | ||
| 27 | - private EditText mAudioBitRateEditText; | ||
| 28 | - private RadioButton mRes360Button; | ||
| 29 | - private RadioButton mRes480Button; | ||
| 30 | - private RadioButton mRes540Button; | ||
| 31 | - private RadioButton mRes720Button; | ||
| 32 | 25 | ||
| 33 | private RadioButton mLandscapeButton; | 26 | private RadioButton mLandscapeButton; |
| 34 | private RadioButton mPortraitButton; | 27 | private RadioButton mPortraitButton; |
| 35 | 28 | ||
| 36 | - private RadioButton mSWButton; | ||
| 37 | - private RadioButton mHWButton; | ||
| 38 | - private RadioButton mSW1Button; | ||
| 39 | - | ||
| 40 | private EditText activityId; | 29 | private EditText activityId; |
| 41 | private EditText channelId; | 30 | private EditText channelId; |
| 42 | 31 | ||
| @@ -49,21 +38,8 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe | @@ -49,21 +38,8 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe | ||
| 49 | mConnectButton = (Button) findViewById(R.id.connectBT); | 38 | mConnectButton = (Button) findViewById(R.id.connectBT); |
| 50 | mConnectButton.setOnClickListener(this); | 39 | mConnectButton.setOnClickListener(this); |
| 51 | 40 | ||
| 52 | - mFrameRateEditText = (EditText) findViewById(R.id.frameRatePicker); | ||
| 53 | - mFrameRateEditText.setInputType(InputType.TYPE_CLASS_NUMBER); | ||
| 54 | - mVideoBitRateEditText = (EditText) findViewById(R.id.videoBitratePicker); | ||
| 55 | - mVideoBitRateEditText.setInputType(InputType.TYPE_CLASS_NUMBER); | ||
| 56 | - mAudioBitRateEditText = (EditText) findViewById(R.id.audioBitratePicker); | ||
| 57 | - mAudioBitRateEditText.setInputType(InputType.TYPE_CLASS_NUMBER); | ||
| 58 | - mRes360Button = (RadioButton) findViewById(R.id.radiobutton1); | ||
| 59 | - mRes480Button = (RadioButton) findViewById(R.id.radiobutton2); | ||
| 60 | - mRes540Button = (RadioButton) findViewById(R.id.radiobutton3); | ||
| 61 | - mRes720Button = (RadioButton) findViewById(R.id.radiobutton4); | ||
| 62 | mLandscapeButton = (RadioButton) findViewById(R.id.orientationbutton1); | 41 | mLandscapeButton = (RadioButton) findViewById(R.id.orientationbutton1); |
| 63 | mPortraitButton = (RadioButton) findViewById(R.id.orientationbutton2); | 42 | mPortraitButton = (RadioButton) findViewById(R.id.orientationbutton2); |
| 64 | - mSWButton = (RadioButton) findViewById(R.id.encode_sw); | ||
| 65 | - mHWButton = (RadioButton) findViewById(R.id.encode_hw); | ||
| 66 | - mSW1Button = (RadioButton) findViewById(R.id.encode_sw1); | ||
| 67 | 43 | ||
| 68 | activityId = (EditText) findViewById(R.id.activityId); | 44 | activityId = (EditText) findViewById(R.id.activityId); |
| 69 | channelId = (EditText) findViewById(R.id.channelId); | 45 | channelId = (EditText) findViewById(R.id.channelId); |
| @@ -73,60 +49,19 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe | @@ -73,60 +49,19 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe | ||
| 73 | public void onClick(View view) { | 49 | public void onClick(View view) { |
| 74 | switch (view.getId()) { | 50 | switch (view.getId()) { |
| 75 | case R.id.connectBT: | 51 | case R.id.connectBT: |
| 76 | - int frameRate = 0; | ||
| 77 | - int videoBitRate = 0; | ||
| 78 | - int audioBitRate = 0; | ||
| 79 | - int videoResolution; | ||
| 80 | - int encodeMethod; | ||
| 81 | - boolean landscape; | ||
| 82 | String activityID = ""; | 52 | String activityID = ""; |
| 83 | String channelID = ""; | 53 | String channelID = ""; |
| 54 | + boolean landscape; | ||
| 84 | 55 | ||
| 85 | - if (!TextUtils.isEmpty(mFrameRateEditText.getText().toString())) { | ||
| 86 | - frameRate = Integer.parseInt(mFrameRateEditText.getText() | ||
| 87 | - .toString()); | ||
| 88 | - } | ||
| 89 | - | ||
| 90 | - if (!TextUtils.isEmpty(mVideoBitRateEditText.getText().toString())) { | ||
| 91 | - videoBitRate = Integer.parseInt(mVideoBitRateEditText.getText() | ||
| 92 | - .toString()); | ||
| 93 | - } | ||
| 94 | - | ||
| 95 | - if (!TextUtils.isEmpty(mAudioBitRateEditText.getText().toString())) { | ||
| 96 | - audioBitRate = Integer.parseInt(mAudioBitRateEditText.getText() | ||
| 97 | - .toString()); | ||
| 98 | - } | ||
| 99 | - | ||
| 100 | - if (!TextUtils.isEmpty(activityId.getText().toString())){ | 56 | + if (!TextUtils.isEmpty(activityId.getText().toString())) { |
| 101 | activityID = activityId.getText().toString(); | 57 | activityID = activityId.getText().toString(); |
| 102 | } | 58 | } |
| 103 | 59 | ||
| 104 | - if (!TextUtils.isEmpty(channelId.getText().toString())){ | 60 | + if (!TextUtils.isEmpty(channelId.getText().toString())) { |
| 105 | channelID = activityId.getText().toString(); | 61 | channelID = activityId.getText().toString(); |
| 106 | } | 62 | } |
| 107 | - | ||
| 108 | - if (mRes360Button.isChecked()) { | ||
| 109 | - videoResolution = VIDEO_RESOLUTION_360P; | ||
| 110 | - } else if (mRes480Button.isChecked()) { | ||
| 111 | - videoResolution = VIDEO_RESOLUTION_480P; | ||
| 112 | - } else if (mRes540Button.isChecked()) { | ||
| 113 | - videoResolution = VIDEO_RESOLUTION_540P; | ||
| 114 | - } else { | ||
| 115 | - videoResolution = VIDEO_RESOLUTION_720P; | ||
| 116 | - } | ||
| 117 | - | ||
| 118 | - if (mHWButton.isChecked()) { | ||
| 119 | - encodeMethod = ENCODE_METHOD_HARDWARE; | ||
| 120 | - } else if (mSWButton.isChecked()) { | ||
| 121 | - encodeMethod = ENCODE_METHOD_SOFTWARE; | ||
| 122 | - } else { | ||
| 123 | - encodeMethod = ENCODE_METHOD_SOFTWARE_COMPAT; | ||
| 124 | - } | ||
| 125 | - | ||
| 126 | landscape = mLandscapeButton.isChecked(); | 63 | landscape = mLandscapeButton.isChecked(); |
| 127 | - | ||
| 128 | - StreamActivity.startActivity(getApplicationContext(), 0, frameRate, videoBitRate, | ||
| 129 | - audioBitRate, videoResolution, landscape, encodeMethod, activityID, channelID); | 64 | + StreamActivity.startActivity(getApplicationContext(), 0, activityID, channelID, landscape); |
| 130 | break; | 65 | break; |
| 131 | default: | 66 | default: |
| 132 | break; | 67 | break; |
app/src/main/java/com/cnlive/demo/stream/StreamActivity.java
| @@ -15,7 +15,6 @@ import android.os.Bundle; | @@ -15,7 +15,6 @@ import android.os.Bundle; | ||
| 15 | import android.os.Handler; | 15 | import android.os.Handler; |
| 16 | import android.os.SystemClock; | 16 | import android.os.SystemClock; |
| 17 | import android.support.v4.app.ActivityCompat; | 17 | import android.support.v4.app.ActivityCompat; |
| 18 | -import android.text.TextUtils; | ||
| 19 | import android.util.Log; | 18 | import android.util.Log; |
| 20 | import android.view.KeyEvent; | 19 | import android.view.KeyEvent; |
| 21 | import android.view.View; | 20 | import android.view.View; |
| @@ -32,8 +31,9 @@ import com.cnlive.libs.stream.base.IStreamer; | @@ -32,8 +31,9 @@ import com.cnlive.libs.stream.base.IStreamer; | ||
| 32 | import com.cnlive.libs.stream.model.ActivityConfig; | 31 | import com.cnlive.libs.stream.model.ActivityConfig; |
| 33 | 32 | ||
| 34 | import java.util.Timer; | 33 | import java.util.Timer; |
| 35 | -import java.util.TimerTask; | ||
| 36 | 34 | ||
| 35 | +import static com.cnlive.libs.stream.base.IStreamer.ENCODE_METHOD_HARDWARE; | ||
| 36 | +import static com.cnlive.libs.stream.base.IStreamer.VIDEO_RESOLUTION_360P; | ||
| 37 | import static com.cnlive.libs.stream.model.Filters.BEAUTY_DISABLE; | 37 | import static com.cnlive.libs.stream.model.Filters.BEAUTY_DISABLE; |
| 38 | import static com.cnlive.libs.stream.model.Filters.BEAUTY_ILLUSION; | 38 | import static com.cnlive.libs.stream.model.Filters.BEAUTY_ILLUSION; |
| 39 | import static com.cnlive.libs.stream.model.Filters.BEAUTY_SMOOTH; | 39 | import static com.cnlive.libs.stream.model.Filters.BEAUTY_SMOOTH; |
| @@ -67,7 +67,6 @@ public class StreamActivity extends Activity { | @@ -67,7 +67,6 @@ public class StreamActivity extends Activity { | ||
| 67 | 67 | ||
| 68 | private Streamer mStreamer; | 68 | private Streamer mStreamer; |
| 69 | private Handler mMainHandler; | 69 | private Handler mMainHandler; |
| 70 | - private Timer mTimer; | ||
| 71 | 70 | ||
| 72 | private boolean mIsLandscape; | 71 | private boolean mIsLandscape; |
| 73 | private boolean mRecording = false; | 72 | private boolean mRecording = false; |
| @@ -84,35 +83,20 @@ public class StreamActivity extends Activity { | @@ -84,35 +83,20 @@ public class StreamActivity extends Activity { | ||
| 84 | private static final String START_STRING = "开始直播"; | 83 | private static final String START_STRING = "开始直播"; |
| 85 | private static final String STOP_STRING = "停止直播"; | 84 | private static final String STOP_STRING = "停止直播"; |
| 86 | 85 | ||
| 87 | - public final static String FRAME_RATE = "framerate"; | ||
| 88 | - public final static String VIDEO_BITRATE = "video_bitrate"; | ||
| 89 | - public final static String AUDIO_BITRATE = "audio_bitrate"; | ||
| 90 | - public final static String VIDEO_RESOLUTION = "video_resolution"; | ||
| 91 | - public final static String LANDSCAPE = "landscape"; | ||
| 92 | - public final static String ENCDODE_METHOD = "encode_method"; | ||
| 93 | - public final static String START_ATUO = "start_auto"; | ||
| 94 | - public static final String SHOW_DEBUGINFO = "show_debuginfo"; | ||
| 95 | public static final String ACTIVITYID = "activityId"; | 86 | public static final String ACTIVITYID = "activityId"; |
| 96 | public static final String CHANNELID = "channelId"; | 87 | public static final String CHANNELID = "channelId"; |
| 88 | + public final static String LANDSCAPE = "landscape"; | ||
| 97 | 89 | ||
| 98 | public static void startActivity(Context context, int fromType, | 90 | public static void startActivity(Context context, int fromType, |
| 99 | - int frameRate, | ||
| 100 | - int videoBitrate, int audioBitrate, | ||
| 101 | - int videoResolution, boolean isLandscape, | ||
| 102 | - int encodeMethod, | ||
| 103 | String activityID, | 91 | String activityID, |
| 104 | - String channelID) { | 92 | + String channelID, |
| 93 | + boolean isLandscape) { | ||
| 105 | Intent intent = new Intent(context, StreamActivity.class); | 94 | Intent intent = new Intent(context, StreamActivity.class); |
| 106 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | 95 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| 107 | intent.putExtra("type", fromType); | 96 | intent.putExtra("type", fromType); |
| 108 | - intent.putExtra(FRAME_RATE, frameRate); | ||
| 109 | - intent.putExtra(VIDEO_BITRATE, videoBitrate); | ||
| 110 | - intent.putExtra(AUDIO_BITRATE, audioBitrate); | ||
| 111 | - intent.putExtra(VIDEO_RESOLUTION, videoResolution); | ||
| 112 | - intent.putExtra(LANDSCAPE, isLandscape); | ||
| 113 | - intent.putExtra(ENCDODE_METHOD, encodeMethod); | ||
| 114 | intent.putExtra(ACTIVITYID, activityID); | 97 | intent.putExtra(ACTIVITYID, activityID); |
| 115 | intent.putExtra(CHANNELID, channelID); | 98 | intent.putExtra(CHANNELID, channelID); |
| 99 | + intent.putExtra(LANDSCAPE, isLandscape); | ||
| 116 | context.startActivity(intent); | 100 | context.startActivity(intent); |
| 117 | } | 101 | } |
| 118 | 102 | ||
| @@ -126,6 +110,18 @@ public class StreamActivity extends Activity { | @@ -126,6 +110,18 @@ public class StreamActivity extends Activity { | ||
| 126 | WindowManager.LayoutParams.FLAG_FULLSCREEN); | 110 | WindowManager.LayoutParams.FLAG_FULLSCREEN); |
| 127 | getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); | 111 | getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); |
| 128 | 112 | ||
| 113 | + initView(); | ||
| 114 | + | ||
| 115 | + mMainHandler = new Handler(); | ||
| 116 | + Bundle bundle = getIntent().getExtras(); | ||
| 117 | + activityId = bundle.getString(ACTIVITYID); | ||
| 118 | + channelId = bundle.getString(CHANNELID); | ||
| 119 | + mIsLandscape = bundle.getBoolean(LANDSCAPE, false); | ||
| 120 | + initStreamer(); | ||
| 121 | + | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + private void initView() { | ||
| 129 | mCameraHintView = (CameraHintView) findViewById(R.id.camera_hint); | 125 | mCameraHintView = (CameraHintView) findViewById(R.id.camera_hint); |
| 130 | mCameraPreviewView = (GLSurfaceView) findViewById(R.id.camera_preview); | 126 | mCameraPreviewView = (GLSurfaceView) findViewById(R.id.camera_preview); |
| 131 | mChronometer = (Chronometer) findViewById(R.id.chronometer); | 127 | mChronometer = (Chronometer) findViewById(R.id.chronometer); |
| @@ -155,55 +151,50 @@ public class StreamActivity extends Activity { | @@ -155,55 +151,50 @@ public class StreamActivity extends Activity { | ||
| 155 | mFrontMirrorCheckBox.setOnCheckedChangeListener(mCheckBoxObserver); | 151 | mFrontMirrorCheckBox.setOnCheckedChangeListener(mCheckBoxObserver); |
| 156 | mAudioOnlyCheckBox = (CheckBox) findViewById(R.id.audio_only); | 152 | mAudioOnlyCheckBox = (CheckBox) findViewById(R.id.audio_only); |
| 157 | mAudioOnlyCheckBox.setOnCheckedChangeListener(mCheckBoxObserver); | 153 | mAudioOnlyCheckBox.setOnCheckedChangeListener(mCheckBoxObserver); |
| 154 | + } | ||
| 158 | 155 | ||
| 159 | - mMainHandler = new Handler(); | 156 | + private void initStreamer() { |
| 160 | mStreamer = new Streamer(this); | 157 | mStreamer = new Streamer(this); |
| 161 | - Bundle bundle = getIntent().getExtras(); | ||
| 162 | - if (bundle != null) { | ||
| 163 | - int frameRate = bundle.getInt(FRAME_RATE, 0); | ||
| 164 | - if (frameRate > 0) { | ||
| 165 | - mStreamer.setPreviewFps(frameRate); | ||
| 166 | - mStreamer.setTargetFps(frameRate); | ||
| 167 | - } | ||
| 168 | - | ||
| 169 | - int videoBitrate = bundle.getInt(VIDEO_BITRATE, 0); | ||
| 170 | - if (videoBitrate > 0) { | ||
| 171 | - mStreamer.setVideoKBitrate(videoBitrate * 3 / 4, videoBitrate, videoBitrate / 4); | ||
| 172 | - } | ||
| 173 | - | ||
| 174 | - int audioBitrate = bundle.getInt(AUDIO_BITRATE, 0); | ||
| 175 | - if (audioBitrate > 0) { | ||
| 176 | - mStreamer.setAudioKBitrate(audioBitrate); | ||
| 177 | - } | ||
| 178 | - | ||
| 179 | - int videoResolution = bundle.getInt(VIDEO_RESOLUTION, 0); | ||
| 180 | - mStreamer.setPreviewResolution(videoResolution); | ||
| 181 | - mStreamer.setTargetResolution(videoResolution); | ||
| 182 | - | ||
| 183 | - int encode_method = bundle.getInt(ENCDODE_METHOD); | ||
| 184 | - mStreamer.setEncodeMethod(encode_method); | ||
| 185 | - | ||
| 186 | - mIsLandscape = bundle.getBoolean(LANDSCAPE, false); | ||
| 187 | - mStreamer.setRotateDegrees(mIsLandscape ? 90 : 0); | ||
| 188 | - if (mIsLandscape) { | ||
| 189 | - setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); | ||
| 190 | - isHorizontalScreen = 1; | ||
| 191 | - } else { | ||
| 192 | - setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); | ||
| 193 | - isHorizontalScreen = 0; | ||
| 194 | - } | 158 | + //设置预览编码帧率 |
| 159 | + mStreamer.setPreviewFps(15); | ||
| 160 | + //设置推流编码帧率 | ||
| 161 | + mStreamer.setTargetFps(15); | ||
| 162 | + //设置初始、最大、最小视频码率 | ||
| 163 | + mStreamer.setVideoKBitrate(800 * 3 / 4, 800, 800 / 4); | ||
| 164 | + //设置音频编码码率 | ||
| 165 | + mStreamer.setAudioBitrate(48); | ||
| 166 | + //分别设置预览和推流分辨率 | ||
| 167 | + mStreamer.setPreviewResolution(VIDEO_RESOLUTION_360P); | ||
| 168 | + mStreamer.setTargetResolution(VIDEO_RESOLUTION_360P); | ||
| 169 | + //设置编码模式(硬编/软编/软编兼容) | ||
| 170 | + mStreamer.setEncodeMethod(ENCODE_METHOD_HARDWARE); | ||
| 171 | + | ||
| 172 | + //设置横竖屏方向 | ||
| 173 | + mStreamer.setRotateDegrees(mIsLandscape ? 90 : 0);//设置屏幕旋转角度 | ||
| 174 | + if (mIsLandscape) { | ||
| 175 | + setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);//横屏 | ||
| 176 | + isHorizontalScreen = 1; | ||
| 177 | + } else { | ||
| 178 | + setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);//竖屏 | ||
| 179 | + isHorizontalScreen = 0; | ||
| 195 | } | 180 | } |
| 196 | - | 181 | + //设置预览View |
| 197 | mStreamer.setDisplayPreview(mCameraPreviewView); | 182 | mStreamer.setDisplayPreview(mCameraPreviewView); |
| 183 | + | ||
| 184 | + // 开启推流统计功能 | ||
| 198 | mStreamer.setEnableStreamStatModule(true); | 185 | mStreamer.setEnableStreamStatModule(true); |
| 199 | - mStreamer.enableDebugLog(true); | 186 | + //设置前置摄像头镜像 |
| 200 | mStreamer.setFrontCameraMirror(mFrontMirrorCheckBox.isChecked()); | 187 | mStreamer.setFrontCameraMirror(mFrontMirrorCheckBox.isChecked()); |
| 188 | + //静音 | ||
| 201 | mStreamer.setMuteAudio(mMuteCheckBox.isChecked()); | 189 | mStreamer.setMuteAudio(mMuteCheckBox.isChecked()); |
| 190 | + //耳返 | ||
| 202 | mStreamer.setEnableAudioPreview(mAudioPreviewCheckBox.isChecked()); | 191 | mStreamer.setEnableAudioPreview(mAudioPreviewCheckBox.isChecked()); |
| 192 | + //设置Info回调,可以收到相关通知信息 | ||
| 203 | mStreamer.setOnInfoListener(mOnInfoListener); | 193 | mStreamer.setOnInfoListener(mOnInfoListener); |
| 194 | + //设置错误回调,收到该回调后,一般是发生了严重错误,比如网络断开等 | ||
| 204 | mStreamer.setOnErrorListener(mOnErrorListener); | 195 | mStreamer.setOnErrorListener(mOnErrorListener); |
| 205 | - mStreamer.getImgTexFilterMgt().setFilter(mStreamer.getGLRender(), | ||
| 206 | - DENOISE.getFilter()); | 196 | + //设置美颜滤镜 |
| 197 | + mStreamer.getImgTexFilterMgt().setFilter(mStreamer.getGLRender(), DENOISE.getFilter()); | ||
| 207 | mStreamer.setEnableImgBufBeauty(true); | 198 | mStreamer.setEnableImgBufBeauty(true); |
| 208 | 199 | ||
| 209 | //手动变焦 | 200 | //手动变焦 |
| @@ -212,9 +203,6 @@ public class StreamActivity extends Activity { | @@ -212,9 +203,6 @@ public class StreamActivity extends Activity { | ||
| 212 | mStreamer.setCameraHintView(mCameraHintView); | 203 | mStreamer.setCameraHintView(mCameraHintView); |
| 213 | mStreamer.setEnableTouchFocus(true); | 204 | mStreamer.setEnableTouchFocus(true); |
| 214 | mStreamer.setEnableZoom(true); | 205 | mStreamer.setEnableZoom(true); |
| 215 | - | ||
| 216 | - activityId = bundle.getString(ACTIVITYID); | ||
| 217 | - channelId = bundle.getString(CHANNELID); | ||
| 218 | } | 206 | } |
| 219 | 207 | ||
| 220 | @Override | 208 | @Override |
| @@ -247,9 +235,7 @@ public class StreamActivity extends Activity { | @@ -247,9 +235,7 @@ public class StreamActivity extends Activity { | ||
| 247 | mMainHandler.removeCallbacksAndMessages(null); | 235 | mMainHandler.removeCallbacksAndMessages(null); |
| 248 | mMainHandler = null; | 236 | mMainHandler = null; |
| 249 | } | 237 | } |
| 250 | - if (mTimer != null) { | ||
| 251 | - mTimer.cancel(); | ||
| 252 | - } | 238 | + mStreamer.release(); |
| 253 | } | 239 | } |
| 254 | 240 | ||
| 255 | @Override | 241 | @Override |
| @@ -334,13 +320,16 @@ public class StreamActivity extends Activity { | @@ -334,13 +320,16 @@ public class StreamActivity extends Activity { | ||
| 334 | break; | 320 | break; |
| 335 | } | 321 | } |
| 336 | } | 322 | } |
| 323 | + | ||
| 337 | } | 324 | } |
| 338 | 325 | ||
| 326 | + //转换摄像头 | ||
| 339 | private void onSwitchCamera() { | 327 | private void onSwitchCamera() { |
| 340 | mStreamer.switchCamera(); | 328 | mStreamer.switchCamera(); |
| 341 | mCameraHintView.hideAll(); | 329 | mCameraHintView.hideAll(); |
| 342 | } | 330 | } |
| 343 | 331 | ||
| 332 | + //闪光灯 | ||
| 344 | private void onFlashClick() { | 333 | private void onFlashClick() { |
| 345 | if (isFlashOpened) { | 334 | if (isFlashOpened) { |
| 346 | mStreamer.toggleTorch(false); | 335 | mStreamer.toggleTorch(false); |
| @@ -366,6 +355,7 @@ public class StreamActivity extends Activity { | @@ -366,6 +355,7 @@ public class StreamActivity extends Activity { | ||
| 366 | public void onClick(DialogInterface arg0, int arg1) { | 355 | public void onClick(DialogInterface arg0, int arg1) { |
| 367 | mChronometer.stop(); | 356 | mChronometer.stop(); |
| 368 | mRecording = false; | 357 | mRecording = false; |
| 358 | + mStreamer.stopStream(activityConfig); | ||
| 369 | StreamActivity.this.finish(); | 359 | StreamActivity.this.finish(); |
| 370 | } | 360 | } |
| 371 | }).show(); | 361 | }).show(); |
| @@ -395,6 +385,7 @@ public class StreamActivity extends Activity { | @@ -395,6 +385,7 @@ public class StreamActivity extends Activity { | ||
| 395 | } | 385 | } |
| 396 | } | 386 | } |
| 397 | 387 | ||
| 388 | + //背景音乐 | ||
| 398 | private void onBgmChecked(boolean isChecked) { | 389 | private void onBgmChecked(boolean isChecked) { |
| 399 | if (isChecked) { | 390 | if (isChecked) { |
| 400 | mStreamer.startBgm(mBgmPath, true); | 391 | mStreamer.startBgm(mBgmPath, true); |
| @@ -426,22 +417,24 @@ public class StreamActivity extends Activity { | @@ -426,22 +417,24 @@ public class StreamActivity extends Activity { | ||
| 426 | mStreamer.setAudioOnly(isChecked); | 417 | mStreamer.setAudioOnly(isChecked); |
| 427 | } | 418 | } |
| 428 | 419 | ||
| 420 | + //显示水印 | ||
| 429 | private void showWaterMark() { | 421 | private void showWaterMark() { |
| 430 | if (!mIsLandscape) { | 422 | if (!mIsLandscape) { |
| 431 | mStreamer.showWaterMarkLogo(mLogoPath, 0.08f, 0.04f, 0.20f, 0, 0.8f); | 423 | mStreamer.showWaterMarkLogo(mLogoPath, 0.08f, 0.04f, 0.20f, 0, 0.8f); |
| 432 | mStreamer.showWaterMarkTime(0.03f, 0.01f, 0.35f, Color.RED, 1.0f); | 424 | mStreamer.showWaterMarkTime(0.03f, 0.01f, 0.35f, Color.RED, 1.0f); |
| 433 | } else { | 425 | } else { |
| 434 | - mStreamer.showWaterMarkLogo(mLogoPath, 0.05f, 0.09f, 0, 0.20f, 0.8f); | 426 | + mStreamer.showWaterMarkLogo(mLogoPath, 0.05f, 0.09f, 0, 0.08f, 0.8f); |
| 435 | mStreamer.showWaterMarkTime(0.01f, 0.03f, 0.22f, Color.RED, 1.0f); | 427 | mStreamer.showWaterMarkTime(0.01f, 0.03f, 0.22f, Color.RED, 1.0f); |
| 436 | } | 428 | } |
| 437 | } | 429 | } |
| 438 | 430 | ||
| 439 | - //TODO 隐藏水印 | 431 | + //隐藏水印 |
| 440 | private void hideWaterMark() { | 432 | private void hideWaterMark() { |
| 441 | mStreamer.hideWaterMarkLogo(); | 433 | mStreamer.hideWaterMarkLogo(); |
| 442 | mStreamer.hideWaterMarkTime(); | 434 | mStreamer.hideWaterMarkTime(); |
| 443 | } | 435 | } |
| 444 | 436 | ||
| 437 | + //摄像头权限检测 | ||
| 445 | private void startCameraPreviewWithPermCheck() { | 438 | private void startCameraPreviewWithPermCheck() { |
| 446 | int cameraPerm = ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA); | 439 | int cameraPerm = ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA); |
| 447 | int audioPerm = ActivityCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO); | 440 | int audioPerm = ActivityCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO); |
| @@ -463,6 +456,7 @@ public class StreamActivity extends Activity { | @@ -463,6 +456,7 @@ public class StreamActivity extends Activity { | ||
| 463 | } | 456 | } |
| 464 | } | 457 | } |
| 465 | 458 | ||
| 459 | + //选择美颜滤镜 | ||
| 466 | private void showChooseFilter() { | 460 | private void showChooseFilter() { |
| 467 | AlertDialog alertDialog; | 461 | AlertDialog alertDialog; |
| 468 | alertDialog = new AlertDialog.Builder(this) | 462 | alertDialog = new AlertDialog.Builder(this) |
| @@ -594,17 +588,12 @@ public class StreamActivity extends Activity { | @@ -594,17 +588,12 @@ public class StreamActivity extends Activity { | ||
| 594 | break; | 588 | break; |
| 595 | default: | 589 | default: |
| 596 | stopStream(); | 590 | stopStream(); |
| 597 | - mMainHandler.postDelayed(new Runnable() { | ||
| 598 | - @Override | ||
| 599 | - public void run() { | ||
| 600 | - startStream(); | ||
| 601 | - } | ||
| 602 | - }, 3000); | ||
| 603 | break; | 591 | break; |
| 604 | } | 592 | } |
| 605 | } | 593 | } |
| 606 | }; | 594 | }; |
| 607 | 595 | ||
| 596 | + //设置推流参数(注意:必传参数为activityId、channelId) | ||
| 608 | ActivityConfig activityConfig = new ActivityConfig() { | 597 | ActivityConfig activityConfig = new ActivityConfig() { |
| 609 | @Override | 598 | @Override |
| 610 | public String getActivityID() { | 599 | public String getActivityID() { |
app/src/main/res/drawable-xhdpi/record_exit_disable.png deleted
100644 → 0
1.85 KB
app/src/main/res/drawable-xhdpi/record_exit_normal.png deleted
100644 → 0
1.85 KB
app/src/main/res/drawable-xhdpi/record_exitsure_normal.png deleted
100644 → 0
1.69 KB
app/src/main/res/drawable-xhdpi/record_flash_disable.png deleted
100644 → 0
797 Bytes
app/src/main/res/drawable-xhdpi/record_flash_highlighted.png deleted
100644 → 0
705 Bytes
app/src/main/res/drawable-xhdpi/record_flash_normal.png deleted
100644 → 0
775 Bytes
app/src/main/res/drawable-xhdpi/record_switch_camera_disable.png deleted
100644 → 0
3.56 KB
app/src/main/res/drawable-xhdpi/record_switch_camera_highlighted.png deleted
100644 → 0
3.12 KB
app/src/main/res/drawable-xhdpi/record_switch_camera_normal.png deleted
100644 → 0
3.15 KB
app/src/main/res/drawable-xxhdpi/icon_record_close_off.png
0 → 100644
5.67 KB
app/src/main/res/drawable-xxhdpi/icon_record_flash_off.png
0 → 100644
3.77 KB
app/src/main/res/drawable-xxhdpi/icon_record_flip_off.png
0 → 100644
4.03 KB
app/src/main/res/drawable-xxhdpi/ksy_logo.png deleted
100644 → 0
5.53 KB
app/src/main/res/drawable/recorder_delete_icon.xml deleted
100644 → 0
| 1 | -<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | - | ||
| 3 | -<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 4 | - <item android:drawable="@drawable/record_exit_disable" | ||
| 5 | - android:state_enabled="false"/> | ||
| 6 | - <item android:drawable="@drawable/record_exit_normal" | ||
| 7 | - android:state_pressed="true"/> | ||
| 8 | - <item android:drawable="@drawable/record_exitsure_normal" | ||
| 9 | - android:state_selected="true"/> | ||
| 10 | - <item android:drawable="@drawable/record_exit_normal"/> | ||
| 11 | -</selector> | ||
| 12 | \ No newline at end of file | 0 | \ No newline at end of file |
app/src/main/res/drawable/recorder_flash_icon.xml deleted
100644 → 0
| 1 | -<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | -<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 3 | - <item android:drawable="@drawable/record_flash_disable" android:state_enabled="false" /> | ||
| 4 | - <item android:drawable="@drawable/record_flash_highlighted" android:state_pressed="true" /> | ||
| 5 | - <item android:drawable="@drawable/record_flash_normal" /> | ||
| 6 | -</selector> |
app/src/main/res/drawable/recorder_rotate_icon.xml deleted
100644 → 0
| 1 | -<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | - | ||
| 3 | -<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 4 | - <item android:drawable="@drawable/record_switch_camera_disable" | ||
| 5 | - android:state_enabled="false"/> | ||
| 6 | - <item android:drawable="@drawable/record_switch_camera_highlighted" | ||
| 7 | - android:state_pressed="true"/> | ||
| 8 | - <item android:drawable="@drawable/record_switch_camera_normal"/> | ||
| 9 | -</selector> | ||
| 10 | \ No newline at end of file | 0 | \ No newline at end of file |
app/src/main/res/layout/activity_main.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | -<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" | 2 | +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:tools="http://schemas.android.com/tools" | 3 | xmlns:tools="http://schemas.android.com/tools" |
| 4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
| 5 | android:layout_height="match_parent" | 5 | android:layout_height="match_parent" |
| 6 | + android:focusable="true" | ||
| 7 | + android:focusableInTouchMode="true" | ||
| 8 | + android:padding="16dp" | ||
| 6 | tools:context=".MainActivity"> | 9 | tools:context=".MainActivity"> |
| 7 | 10 | ||
| 8 | - <RelativeLayout | ||
| 9 | - android:id="@+id/main" | ||
| 10 | - android:layout_width="match_parent" | ||
| 11 | - android:layout_height="match_parent" | ||
| 12 | - android:focusable="true" | ||
| 13 | - android:focusableInTouchMode="true"> | ||
| 14 | - | ||
| 15 | - <Button | ||
| 16 | - android:id="@+id/connectBT" | ||
| 17 | - android:layout_width="match_parent" | ||
| 18 | - android:layout_height="wrap_content" | ||
| 19 | - android:layout_marginTop="10dp" | ||
| 20 | - android:text="准备直播" /> | ||
| 21 | - | ||
| 22 | - <RadioGroup | ||
| 23 | - android:id="@+id/resolution_group" | ||
| 24 | - android:layout_width="wrap_content" | ||
| 25 | - android:layout_height="wrap_content" | ||
| 26 | - android:layout_below="@id/connectBT" | ||
| 27 | - android:orientation="horizontal"> | ||
| 28 | - | ||
| 29 | - <RadioButton | ||
| 30 | - android:id="@+id/radiobutton1" | ||
| 31 | - android:layout_width="wrap_content" | ||
| 32 | - android:layout_height="wrap_content" | ||
| 33 | - android:checked="true" | ||
| 34 | - android:text="360P" /> | ||
| 35 | - | ||
| 36 | - <RadioButton | ||
| 37 | - android:id="@+id/radiobutton2" | ||
| 38 | - android:layout_width="wrap_content" | ||
| 39 | - android:layout_height="wrap_content" | ||
| 40 | - android:checked="false" | ||
| 41 | - android:text="480P" /> | ||
| 42 | - | ||
| 43 | - <RadioButton | ||
| 44 | - android:id="@+id/radiobutton3" | ||
| 45 | - android:layout_width="wrap_content" | ||
| 46 | - android:layout_height="wrap_content" | ||
| 47 | - android:checked="false" | ||
| 48 | - android:text="540P" /> | ||
| 49 | - | ||
| 50 | - <RadioButton | ||
| 51 | - android:id="@+id/radiobutton4" | ||
| 52 | - android:layout_width="wrap_content" | ||
| 53 | - android:layout_height="wrap_content" | ||
| 54 | - android:checked="false" | ||
| 55 | - android:text="720P" /> | ||
| 56 | - </RadioGroup> | ||
| 57 | - | ||
| 58 | - <RadioGroup | ||
| 59 | - android:id="@+id/orientation_group" | ||
| 60 | - android:layout_width="wrap_content" | ||
| 61 | - android:layout_height="wrap_content" | ||
| 62 | - android:layout_below="@id/resolution_group" | ||
| 63 | - android:orientation="horizontal"> | ||
| 64 | - | ||
| 65 | - <RadioButton | ||
| 66 | - android:id="@+id/orientationbutton1" | ||
| 67 | - android:layout_width="wrap_content" | ||
| 68 | - android:layout_height="wrap_content" | ||
| 69 | - android:checked="false" | ||
| 70 | - android:text="横屏" /> | ||
| 71 | 11 | ||
| 72 | - <RadioButton | ||
| 73 | - android:id="@+id/orientationbutton2" | ||
| 74 | - android:layout_width="wrap_content" | ||
| 75 | - android:layout_height="wrap_content" | ||
| 76 | - android:checked="true" | ||
| 77 | - android:text="竖屏" /> | ||
| 78 | - </RadioGroup> | ||
| 79 | - | ||
| 80 | - <RadioGroup | ||
| 81 | - android:id="@+id/encode_group" | ||
| 82 | - android:layout_width="wrap_content" | ||
| 83 | - android:layout_height="wrap_content" | ||
| 84 | - android:layout_below="@id/orientation_group" | ||
| 85 | - android:orientation="horizontal"> | ||
| 86 | - | ||
| 87 | - <RadioButton | ||
| 88 | - android:id="@+id/encode_hw" | ||
| 89 | - android:layout_width="wrap_content" | ||
| 90 | - android:layout_height="wrap_content" | ||
| 91 | - android:checked="false" | ||
| 92 | - android:text="硬编" /> | ||
| 93 | - | ||
| 94 | - <RadioButton | ||
| 95 | - android:id="@+id/encode_sw" | ||
| 96 | - android:layout_width="wrap_content" | ||
| 97 | - android:layout_height="wrap_content" | ||
| 98 | - android:checked="true" | ||
| 99 | - android:text="软编" /> | ||
| 100 | - | ||
| 101 | - <RadioButton | ||
| 102 | - android:id="@+id/encode_sw1" | ||
| 103 | - android:layout_width="wrap_content" | ||
| 104 | - android:layout_height="wrap_content" | ||
| 105 | - android:checked="false" | ||
| 106 | - android:text="软编1" /> | ||
| 107 | - </RadioGroup> | ||
| 108 | - | ||
| 109 | - <LinearLayout | ||
| 110 | - android:id="@+id/init_group" | ||
| 111 | - android:layout_width="match_parent" | ||
| 112 | - android:layout_height="wrap_content" | ||
| 113 | - android:layout_below="@id/encode_group" | ||
| 114 | - android:orientation="vertical"> | ||
| 115 | - | ||
| 116 | - <!--<CheckBox--> | ||
| 117 | - <!--android:id="@+id/autoStart"--> | ||
| 118 | - <!--android:layout_width="wrap_content"--> | ||
| 119 | - <!--android:layout_height="wrap_content"--> | ||
| 120 | - <!--android:checked="false"--> | ||
| 121 | - <!--android:text="初始化完成后启动推流" />--> | ||
| 122 | - | ||
| 123 | - </LinearLayout> | ||
| 124 | - | ||
| 125 | - <LinearLayout | ||
| 126 | - android:id="@+id/frameRate" | ||
| 127 | - android:layout_width="match_parent" | ||
| 128 | - android:layout_height="wrap_content" | ||
| 129 | - android:layout_below="@id/init_group"> | ||
| 130 | - | ||
| 131 | - <TextView | ||
| 132 | - android:layout_width="wrap_content" | ||
| 133 | - android:layout_height="wrap_content" | ||
| 134 | - android:text="采集帧率" | ||
| 135 | - android:textSize="16sp" /> | ||
| 136 | - | ||
| 137 | - <EditText | ||
| 138 | - android:id="@+id/frameRatePicker" | ||
| 139 | - android:layout_width="wrap_content" | ||
| 140 | - android:layout_height="wrap_content" | ||
| 141 | - android:text="15" /> | ||
| 142 | - </LinearLayout> | 12 | + <LinearLayout |
| 13 | + android:id="@+id/stream_param" | ||
| 14 | + android:layout_width="match_parent" | ||
| 15 | + android:layout_height="wrap_content" | ||
| 16 | + android:orientation="vertical"> | ||
| 143 | 17 | ||
| 144 | <LinearLayout | 18 | <LinearLayout |
| 145 | - android:id="@+id/videoBitrate" | ||
| 146 | android:layout_width="match_parent" | 19 | android:layout_width="match_parent" |
| 147 | android:layout_height="wrap_content" | 20 | android:layout_height="wrap_content" |
| 148 | - android:layout_below="@id/frameRate" | ||
| 149 | android:orientation="horizontal"> | 21 | android:orientation="horizontal"> |
| 150 | 22 | ||
| 151 | <TextView | 23 | <TextView |
| 152 | android:layout_width="wrap_content" | 24 | android:layout_width="wrap_content" |
| 153 | android:layout_height="wrap_content" | 25 | android:layout_height="wrap_content" |
| 154 | - android:text="视频码率(Max)" | ||
| 155 | - android:textSize="16sp" /> | 26 | + android:text="ActivityId" |
| 27 | + android:textColor="#000000" | ||
| 28 | + android:textSize="18sp" /> | ||
| 156 | 29 | ||
| 157 | <EditText | 30 | <EditText |
| 158 | - android:id="@+id/videoBitratePicker" | ||
| 159 | - android:layout_width="wrap_content" | 31 | + android:id="@+id/activityId" |
| 32 | + android:layout_width="match_parent" | ||
| 160 | android:layout_height="wrap_content" | 33 | android:layout_height="wrap_content" |
| 161 | - android:text="800" /> | 34 | + android:layout_marginLeft="10dp" |
| 35 | + android:hint="请输入ActivityId" /> | ||
| 162 | </LinearLayout> | 36 | </LinearLayout> |
| 163 | 37 | ||
| 164 | <LinearLayout | 38 | <LinearLayout |
| 165 | - android:id="@+id/audioBitrate" | ||
| 166 | android:layout_width="match_parent" | 39 | android:layout_width="match_parent" |
| 167 | android:layout_height="wrap_content" | 40 | android:layout_height="wrap_content" |
| 168 | - android:layout_below="@id/videoBitrate" | ||
| 169 | android:orientation="horizontal"> | 41 | android:orientation="horizontal"> |
| 170 | 42 | ||
| 171 | <TextView | 43 | <TextView |
| 172 | android:layout_width="wrap_content" | 44 | android:layout_width="wrap_content" |
| 173 | android:layout_height="wrap_content" | 45 | android:layout_height="wrap_content" |
| 174 | - android:text="音频码率" | ||
| 175 | - android:textSize="16sp" /> | 46 | + android:text="ChannelId" |
| 47 | + android:textColor="#000000" | ||
| 48 | + android:textSize="18sp" /> | ||
| 176 | 49 | ||
| 177 | <EditText | 50 | <EditText |
| 178 | - android:id="@+id/audioBitratePicker" | ||
| 179 | - android:layout_width="wrap_content" | ||
| 180 | - android:layout_height="wrap_content" | ||
| 181 | - android:text="48" /> | ||
| 182 | - </LinearLayout> | ||
| 183 | - | ||
| 184 | - <LinearLayout | ||
| 185 | - android:layout_width="match_parent" | ||
| 186 | - android:layout_height="wrap_content" | ||
| 187 | - android:layout_below="@id/audioBitrate" | ||
| 188 | - android:orientation="vertical"> | ||
| 189 | - | ||
| 190 | - <LinearLayout | 51 | + android:id="@+id/channelId" |
| 191 | android:layout_width="match_parent" | 52 | android:layout_width="match_parent" |
| 192 | android:layout_height="wrap_content" | 53 | android:layout_height="wrap_content" |
| 193 | - android:orientation="horizontal"> | 54 | + android:layout_marginLeft="10dp" |
| 55 | + android:hint="请输入ChannelId" /> | ||
| 56 | + </LinearLayout> | ||
| 194 | 57 | ||
| 195 | - <TextView | ||
| 196 | - android:layout_width="wrap_content" | ||
| 197 | - android:layout_height="wrap_content" | ||
| 198 | - android:text="ActivityId" | ||
| 199 | - android:textSize="14sp" /> | 58 | + </LinearLayout> |
| 200 | 59 | ||
| 201 | - <EditText | ||
| 202 | - android:id="@+id/activityId" | ||
| 203 | - android:layout_width="match_parent" | ||
| 204 | - android:layout_height="wrap_content" | ||
| 205 | - android:hint="请输入ActivityId" /> | ||
| 206 | - </LinearLayout> | 60 | + <RadioGroup |
| 61 | + android:id="@+id/orientation_group" | ||
| 62 | + android:layout_width="wrap_content" | ||
| 63 | + android:layout_height="wrap_content" | ||
| 64 | + android:layout_below="@id/stream_param" | ||
| 65 | + android:layout_marginTop="10dp" | ||
| 66 | + android:orientation="horizontal"> | ||
| 207 | 67 | ||
| 208 | - <LinearLayout | ||
| 209 | - android:layout_width="match_parent" | ||
| 210 | - android:layout_height="wrap_content" | ||
| 211 | - android:orientation="horizontal"> | ||
| 212 | - | ||
| 213 | - <TextView | ||
| 214 | - android:layout_width="wrap_content" | ||
| 215 | - android:layout_height="wrap_content" | ||
| 216 | - android:text="ChannelId" | ||
| 217 | - android:textSize="14sp" /> | 68 | + <RadioButton |
| 69 | + android:id="@+id/orientationbutton1" | ||
| 70 | + android:layout_width="wrap_content" | ||
| 71 | + android:layout_height="wrap_content" | ||
| 72 | + android:checked="false" | ||
| 73 | + android:text="横屏" /> | ||
| 218 | 74 | ||
| 219 | - <EditText | ||
| 220 | - android:id="@+id/channelId" | ||
| 221 | - android:layout_width="match_parent" | ||
| 222 | - android:layout_height="wrap_content" | ||
| 223 | - android:hint="请输入ChannelId" /> | ||
| 224 | - </LinearLayout> | 75 | + <RadioButton |
| 76 | + android:id="@+id/orientationbutton2" | ||
| 77 | + android:layout_width="wrap_content" | ||
| 78 | + android:layout_height="wrap_content" | ||
| 79 | + android:checked="true" | ||
| 80 | + android:text="竖屏" /> | ||
| 81 | + </RadioGroup> | ||
| 225 | 82 | ||
| 226 | - </LinearLayout> | 83 | + <Button |
| 84 | + android:id="@+id/connectBT" | ||
| 85 | + android:layout_width="match_parent" | ||
| 86 | + android:layout_height="wrap_content" | ||
| 87 | + android:layout_alignParentBottom="true" | ||
| 88 | + android:layout_marginBottom="16dp" | ||
| 89 | + android:text="准备直播" /> | ||
| 227 | 90 | ||
| 228 | - </RelativeLayout> | ||
| 229 | -</ScrollView> | ||
| 230 | \ No newline at end of file | 91 | \ No newline at end of file |
| 92 | +</RelativeLayout> | ||
| 231 | \ No newline at end of file | 93 | \ No newline at end of file |
app/src/main/res/layout/bottombar.xml
| @@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
| 23 | 23 | ||
| 24 | <CheckBox | 24 | <CheckBox |
| 25 | android:id="@+id/watermark" | 25 | android:id="@+id/watermark" |
| 26 | - android:layout_width="wrap_content" | 26 | + android:layout_width="0dp" |
| 27 | android:layout_height="wrap_content" | 27 | android:layout_height="wrap_content" |
| 28 | android:layout_gravity="center" | 28 | android:layout_gravity="center" |
| 29 | android:layout_marginLeft="10dp" | 29 | android:layout_marginLeft="10dp" |
| @@ -31,12 +31,12 @@ | @@ -31,12 +31,12 @@ | ||
| 31 | android:background="#11123456" | 31 | android:background="#11123456" |
| 32 | android:checked="true" | 32 | android:checked="true" |
| 33 | android:text="水印" | 33 | android:text="水印" |
| 34 | - android:textColor="#FF4081" | 34 | + android:textColor="@android:color/white" |
| 35 | android:textSize="14sp"></CheckBox> | 35 | android:textSize="14sp"></CheckBox> |
| 36 | 36 | ||
| 37 | <CheckBox | 37 | <CheckBox |
| 38 | android:id="@+id/mute" | 38 | android:id="@+id/mute" |
| 39 | - android:layout_width="wrap_content" | 39 | + android:layout_width="0dp" |
| 40 | android:layout_height="wrap_content" | 40 | android:layout_height="wrap_content" |
| 41 | android:layout_gravity="center" | 41 | android:layout_gravity="center" |
| 42 | android:layout_marginLeft="10dp" | 42 | android:layout_marginLeft="10dp" |
| @@ -44,12 +44,12 @@ | @@ -44,12 +44,12 @@ | ||
| 44 | android:background="#11123456" | 44 | android:background="#11123456" |
| 45 | android:checked="false" | 45 | android:checked="false" |
| 46 | android:text="静音" | 46 | android:text="静音" |
| 47 | - android:textColor="#FF4081" | 47 | + android:textColor="@android:color/white" |
| 48 | android:textSize="14sp"></CheckBox> | 48 | android:textSize="14sp"></CheckBox> |
| 49 | 49 | ||
| 50 | <CheckBox | 50 | <CheckBox |
| 51 | android:id="@+id/bgm" | 51 | android:id="@+id/bgm" |
| 52 | - android:layout_width="wrap_content" | 52 | + android:layout_width="0dp" |
| 53 | android:layout_height="wrap_content" | 53 | android:layout_height="wrap_content" |
| 54 | android:layout_gravity="center" | 54 | android:layout_gravity="center" |
| 55 | android:layout_marginLeft="10dp" | 55 | android:layout_marginLeft="10dp" |
| @@ -57,20 +57,20 @@ | @@ -57,20 +57,20 @@ | ||
| 57 | android:background="#11123456" | 57 | android:background="#11123456" |
| 58 | android:checked="false" | 58 | android:checked="false" |
| 59 | android:text="bgm" | 59 | android:text="bgm" |
| 60 | - android:textColor="#FF4081" | 60 | + android:textColor="@android:color/white" |
| 61 | android:textSize="14sp"></CheckBox> | 61 | android:textSize="14sp"></CheckBox> |
| 62 | 62 | ||
| 63 | <CheckBox | 63 | <CheckBox |
| 64 | android:id="@+id/ear_mirror" | 64 | android:id="@+id/ear_mirror" |
| 65 | - android:layout_width="wrap_content" | 65 | + android:layout_width="0dp" |
| 66 | android:layout_height="wrap_content" | 66 | android:layout_height="wrap_content" |
| 67 | android:layout_gravity="center" | 67 | android:layout_gravity="center" |
| 68 | android:layout_marginLeft="10dp" | 68 | android:layout_marginLeft="10dp" |
| 69 | android:layout_weight="1" | 69 | android:layout_weight="1" |
| 70 | android:background="#11123456" | 70 | android:background="#11123456" |
| 71 | android:checked="false" | 71 | android:checked="false" |
| 72 | - android:text="耳反" | ||
| 73 | - android:textColor="#FF4081" | 72 | + android:text="耳返" |
| 73 | + android:textColor="@android:color/white" | ||
| 74 | android:textSize="14sp"></CheckBox> | 74 | android:textSize="14sp"></CheckBox> |
| 75 | </LinearLayout> | 75 | </LinearLayout> |
| 76 | 76 | ||
| @@ -80,28 +80,20 @@ | @@ -80,28 +80,20 @@ | ||
| 80 | android:layout_marginBottom="10dp" | 80 | android:layout_marginBottom="10dp" |
| 81 | android:orientation="horizontal"> | 81 | android:orientation="horizontal"> |
| 82 | 82 | ||
| 83 | - <ImageView | ||
| 84 | - android:id="@+id/backoff" | ||
| 85 | - android:layout_width="wrap_content" | ||
| 86 | - android:layout_height="wrap_content" | ||
| 87 | - android:layout_gravity="center_vertical" | ||
| 88 | - android:layout_marginRight="10dp" | ||
| 89 | - android:background="@drawable/recorder_delete_icon" /> | ||
| 90 | - | ||
| 91 | - <TextView | 83 | + <Button |
| 92 | android:id="@+id/click_to_shoot" | 84 | android:id="@+id/click_to_shoot" |
| 93 | - android:layout_width="wrap_content" | 85 | + android:layout_width="0dp" |
| 94 | android:layout_height="wrap_content" | 86 | android:layout_height="wrap_content" |
| 95 | android:layout_gravity="center" | 87 | android:layout_gravity="center" |
| 88 | + android:layout_marginLeft="10dp" | ||
| 96 | android:layout_weight="1" | 89 | android:layout_weight="1" |
| 97 | - android:background="#11123456" | ||
| 98 | android:text="开始直播" | 90 | android:text="开始直播" |
| 99 | - android:textColor="#FF4081" | ||
| 100 | - android:textSize="14sp"></TextView> | 91 | + android:textColor="@color/colorAccent" |
| 92 | + android:textSize="14sp"></Button> | ||
| 101 | 93 | ||
| 102 | <CheckBox | 94 | <CheckBox |
| 103 | android:id="@+id/audio_only" | 95 | android:id="@+id/audio_only" |
| 104 | - android:layout_width="wrap_content" | 96 | + android:layout_width="0dp" |
| 105 | android:layout_height="wrap_content" | 97 | android:layout_height="wrap_content" |
| 106 | android:layout_gravity="center" | 98 | android:layout_gravity="center" |
| 107 | android:layout_marginLeft="10dp" | 99 | android:layout_marginLeft="10dp" |
| @@ -109,12 +101,12 @@ | @@ -109,12 +101,12 @@ | ||
| 109 | android:background="#11123456" | 101 | android:background="#11123456" |
| 110 | android:checked="false" | 102 | android:checked="false" |
| 111 | android:text="音频推流" | 103 | android:text="音频推流" |
| 112 | - android:textColor="#FF4081" | 104 | + android:textColor="@android:color/white" |
| 113 | android:textSize="14sp"></CheckBox> | 105 | android:textSize="14sp"></CheckBox> |
| 114 | 106 | ||
| 115 | <CheckBox | 107 | <CheckBox |
| 116 | android:id="@+id/front_camera_mirror" | 108 | android:id="@+id/front_camera_mirror" |
| 117 | - android:layout_width="wrap_content" | 109 | + android:layout_width="0dp" |
| 118 | android:layout_height="wrap_content" | 110 | android:layout_height="wrap_content" |
| 119 | android:layout_gravity="center" | 111 | android:layout_gravity="center" |
| 120 | android:layout_marginLeft="10dp" | 112 | android:layout_marginLeft="10dp" |
| @@ -122,12 +114,12 @@ | @@ -122,12 +114,12 @@ | ||
| 122 | android:background="#11123456" | 114 | android:background="#11123456" |
| 123 | android:checked="true" | 115 | android:checked="true" |
| 124 | android:text="前置镜像" | 116 | android:text="前置镜像" |
| 125 | - android:textColor="#FF4081" | 117 | + android:textColor="@android:color/white" |
| 126 | android:textSize="14sp"></CheckBox> | 118 | android:textSize="14sp"></CheckBox> |
| 127 | 119 | ||
| 128 | <CheckBox | 120 | <CheckBox |
| 129 | android:id="@+id/click_to_switch_beauty" | 121 | android:id="@+id/click_to_switch_beauty" |
| 130 | - android:layout_width="wrap_content" | 122 | + android:layout_width="0dp" |
| 131 | android:layout_height="wrap_content" | 123 | android:layout_height="wrap_content" |
| 132 | android:layout_gravity="center" | 124 | android:layout_gravity="center" |
| 133 | android:layout_marginLeft="10dp" | 125 | android:layout_marginLeft="10dp" |
| @@ -135,7 +127,7 @@ | @@ -135,7 +127,7 @@ | ||
| 135 | android:background="#11123456" | 127 | android:background="#11123456" |
| 136 | android:checked="true" | 128 | android:checked="true" |
| 137 | android:text="美颜" | 129 | android:text="美颜" |
| 138 | - android:textColor="#FF4081" | 130 | + android:textColor="@android:color/white" |
| 139 | android:textSize="14sp"></CheckBox> | 131 | android:textSize="14sp"></CheckBox> |
| 140 | 132 | ||
| 141 | </LinearLayout> | 133 | </LinearLayout> |
app/src/main/res/layout/titlebar.xml
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | android:layout_width="fill_parent" | 3 | android:layout_width="fill_parent" |
| 4 | android:layout_height="46dip" | 4 | android:layout_height="46dip" |
| 5 | - android:orientation="horizontal" > | 5 | + android:orientation="horizontal"> |
| 6 | 6 | ||
| 7 | <Chronometer | 7 | <Chronometer |
| 8 | android:id="@+id/chronometer" | 8 | android:id="@+id/chronometer" |
| @@ -13,25 +13,40 @@ | @@ -13,25 +13,40 @@ | ||
| 13 | android:layout_gravity="center" | 13 | android:layout_gravity="center" |
| 14 | android:format="%s" | 14 | android:format="%s" |
| 15 | android:gravity="center" | 15 | android:gravity="center" |
| 16 | - android:textColor="#FF4081" | 16 | + android:textColor="#FFFFFF" |
| 17 | android:textSize="19sp" /> | 17 | android:textSize="19sp" /> |
| 18 | 18 | ||
| 19 | <ImageView | 19 | <ImageView |
| 20 | + android:id="@+id/flash" | ||
| 21 | + android:layout_width="wrap_content" | ||
| 22 | + android:layout_height="wrap_content" | ||
| 23 | + android:layout_gravity="center_vertical" | ||
| 24 | + android:layout_marginRight="12dp" | ||
| 25 | + android:layout_marginTop="8dp" | ||
| 26 | + android:layout_toLeftOf="@+id/switch_cam" | ||
| 27 | + android:background="@drawable/icon_record_flash_off"></ImageView> | ||
| 28 | + | ||
| 29 | + <ImageView | ||
| 20 | android:id="@+id/switch_cam" | 30 | android:id="@+id/switch_cam" |
| 21 | android:layout_width="wrap_content" | 31 | android:layout_width="wrap_content" |
| 22 | android:layout_height="wrap_content" | 32 | android:layout_height="wrap_content" |
| 23 | - android:layout_alignParentRight="true" | 33 | + android:layout_alignParentTop="true" |
| 24 | android:layout_gravity="center_vertical" | 34 | android:layout_gravity="center_vertical" |
| 25 | - android:layout_marginRight="10dp" | ||
| 26 | - android:background="@drawable/recorder_rotate_icon" /> | 35 | + android:layout_marginRight="12dp" |
| 36 | + android:layout_marginTop="8dp" | ||
| 37 | + android:layout_toLeftOf="@+id/backoff" | ||
| 38 | + android:background="@drawable/icon_record_flip_off" /> | ||
| 27 | 39 | ||
| 28 | <ImageView | 40 | <ImageView |
| 29 | - android:id="@+id/flash" | 41 | + android:id="@+id/backoff" |
| 30 | android:layout_width="wrap_content" | 42 | android:layout_width="wrap_content" |
| 31 | android:layout_height="wrap_content" | 43 | android:layout_height="wrap_content" |
| 44 | + android:layout_alignParentEnd="true" | ||
| 45 | + android:layout_alignParentRight="true" | ||
| 46 | + android:layout_alignParentTop="true" | ||
| 32 | android:layout_gravity="center_vertical" | 47 | android:layout_gravity="center_vertical" |
| 33 | - android:layout_toLeftOf="@id/switch_cam" | ||
| 34 | - android:background="@drawable/recorder_flash_icon" > | ||
| 35 | - </ImageView> | 48 | + android:layout_marginRight="2dp" |
| 49 | + android:layout_marginTop="8dp" | ||
| 50 | + android:background="@drawable/icon_record_close_off" /> | ||
| 36 | 51 | ||
| 37 | </RelativeLayout> | 52 | </RelativeLayout> |
| 38 | \ No newline at end of file | 53 | \ No newline at end of file |