add english string.xml

add english string.xml
pull/166/head
xufulong 5 years ago
parent 8208a61e9d
commit 6e3a101c4d
  1. 41
      Live/src/main/java/com/frank/live/LivePusherNew.java
  2. 24
      Live/src/main/res/values-en/strings.xml
  3. 8
      Live/src/main/res/values/strings.xml

@ -13,19 +13,19 @@ import com.frank.live.stream.VideoStreamNew;
public class LivePusherNew { public class LivePusherNew {
//视频编码器打开失败 //error of opening video encoder
private final static int ERROR_VIDEO_ENCODER_OPEN = 0x01; private final static int ERROR_VIDEO_ENCODER_OPEN = 0x01;
//视频帧编码失败 //error of video encoding
private final static int ERROR_VIDEO_ENCODE = 0x02; private final static int ERROR_VIDEO_ENCODE = 0x02;
//音频编码器打开失败 //error of opening audio encoder
private final static int ERROR_AUDIO_ENCODER_OPEN = 0x03; private final static int ERROR_AUDIO_ENCODER_OPEN = 0x03;
//音频帧编码失败 //error of audio encoding
private final static int ERROR_AUDIO_ENCODE = 0x04; private final static int ERROR_AUDIO_ENCODE = 0x04;
//RTMP连接失败 //error of RTMP connecting server
private final static int ERROR_RTMP_CONNECT = 0x05; private final static int ERROR_RTMP_CONNECT = 0x05;
//RTMP连接流失败 //error of RTMP connecting stream
private final static int ERROR_RTMP_CONNECT_STREAM = 0x06; private final static int ERROR_RTMP_CONNECT_STREAM = 0x06;
//RTMP发送数据包失败 //error of RTMP sending packet
private final static int ERROR_RTMP_SEND_PACKET = 0x07; private final static int ERROR_RTMP_SEND_PACKET = 0x07;
static { static {
@ -38,7 +38,10 @@ public class LivePusherNew {
private LiveStateChangeListener liveStateChangeListener; private LiveStateChangeListener liveStateChangeListener;
private Activity activity;
public LivePusherNew(Activity activity, VideoParam videoParam, AudioParam audioParam) { public LivePusherNew(Activity activity, VideoParam videoParam, AudioParam audioParam) {
this.activity = activity;
native_init(); native_init();
videoStream = new VideoStream(this, activity, videoParam.getWidth(), videoParam.getHeight(), videoStream = new VideoStream(this, activity, videoParam.getWidth(), videoParam.getHeight(),
videoParam.getBitRate(), videoParam.getFrameRate(), videoParam.getCameraId()); videoParam.getBitRate(), videoParam.getFrameRate(), videoParam.getCameraId());
@ -60,9 +63,9 @@ public class LivePusherNew {
} }
/** /**
* 设置静音 * setting mute
* *
* @param isMute 是否静音 * @param isMute is mute or not
*/ */
public void setMute(boolean isMute) { public void setMute(boolean isMute) {
audioStream.setMute(isMute); audioStream.setMute(isMute);
@ -88,36 +91,36 @@ public class LivePusherNew {
} }
/** /**
* 当native报错时回调这个方法 * Callback this method, when native occurring error
* *
* @param errCode errCode * @param errCode errCode
*/ */
public void errorFromNative(int errCode) { public void errorFromNative(int errCode) {
//停止推流 //stop pushing stream
stopPush(); stopPush();
if (liveStateChangeListener != null) { if (liveStateChangeListener != null && activity != null) {
String msg = ""; String msg = "";
switch (errCode) { switch (errCode) {
case ERROR_VIDEO_ENCODER_OPEN: case ERROR_VIDEO_ENCODER_OPEN:
msg = "视频编码器打开失败..."; msg = activity.getString(R.string.error_video_encoder);
break; break;
case ERROR_VIDEO_ENCODE: case ERROR_VIDEO_ENCODE:
msg = "视频帧编码失败..."; msg = activity.getString(R.string.error_video_encode);
break; break;
case ERROR_AUDIO_ENCODER_OPEN: case ERROR_AUDIO_ENCODER_OPEN:
msg = "音频编码器打开失败..."; msg = activity.getString(R.string.error_audio_encoder);
break; break;
case ERROR_AUDIO_ENCODE: case ERROR_AUDIO_ENCODE:
msg = "音频帧编码失败..."; msg = activity.getString(R.string.error_audio_encode);
break; break;
case ERROR_RTMP_CONNECT: case ERROR_RTMP_CONNECT:
msg = "RTMP连接失败..."; msg = activity.getString(R.string.error_rtmp_connect);
break; break;
case ERROR_RTMP_CONNECT_STREAM: case ERROR_RTMP_CONNECT_STREAM:
msg = "RTMP连接流失败..."; msg = activity.getString(R.string.error_rtmp_connect_strem);
break; break;
case ERROR_RTMP_SEND_PACKET: case ERROR_RTMP_SEND_PACKET:
msg = "RTMP发送数据包失败..."; msg = activity.getString(R.string.error_rtmp_send_packet);
break; break;
default: default:
break; break;

@ -0,0 +1,24 @@
<resources>
<string name="app_name">live</string>
<string name="swap">swap</string>
<string name="start">start</string>
<string name="stop">stop</string>
<string name="mute">mute</string>
<string name="voice">voice</string>
<string name="effect_beauty">beauty</string>
<string name="effect_cool">cool</string>
<string name="effect_sunrise">sunrise</string>
<string name="effect_sketch">sketch</string>
<string name="effect_white">white</string>
<string name="effect_romantic">romantic</string>
<string name="effect_raw">raw</string>
<string name="error_video_encoder">error of opening video encoder</string>
<string name="error_video_encode">error of video encoding</string>
<string name="error_audio_encoder">error of opening audio encoder</string>
<string name="error_audio_encode">error of audio encoding</string>
<string name="error_rtmp_connect">error of RTMP connecting server</string>
<string name="error_rtmp_connect_strem">error of RTMP connecting stream</string>
<string name="error_rtmp_send_packet">error of RTMP sending packet</string>
</resources>

@ -13,4 +13,12 @@
<string name="effect_white">纯白</string> <string name="effect_white">纯白</string>
<string name="effect_romantic">浪漫</string> <string name="effect_romantic">浪漫</string>
<string name="effect_raw">原图</string> <string name="effect_raw">原图</string>
<string name="error_video_encoder">打开视频编码器失败</string>
<string name="error_video_encode">视频编码失败</string>
<string name="error_audio_encoder">打开音频编码器失败</string>
<string name="error_audio_encode">音频编码失败</string>
<string name="error_rtmp_connect">RTMP连接服务器失败</string>
<string name="error_rtmp_connect_strem">RTMP连接流失败</string>
<string name="error_rtmp_send_packet">RTMP发送数据包失败</string>
</resources> </resources>

Loading…
Cancel
Save