Skip to content

Commit ba6b7cc

Browse files
authored
Merge pull request #99 from ksvc/v4.0.6
update to v4.0.6
2 parents a87b00a + c72c6af commit ba6b7cc

File tree

18 files changed

+3127
-544
lines changed

18 files changed

+3127
-544
lines changed

demo/res/layout/camera_bottombar.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,19 @@
208208
android:textSize="@dimen/font_size_28px">
209209
</TextView>
210210

211+
<TextView
212+
android:id="@+id/click_to_capture_screenshot"
213+
android:layout_width="0dp"
214+
android:layout_height="wrap_content"
215+
android:layout_gravity="center"
216+
android:layout_marginLeft="10dp"
217+
android:layout_weight="1"
218+
android:background="#11123456"
219+
android:text="@string/capture_thumbnail"
220+
android:textColor="@color/font_color_35"
221+
android:textSize="@dimen/font_size_28px">
222+
</TextView>
223+
211224
</LinearLayout>
212225
</LinearLayout>
213226
</RelativeLayout>

demo/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<string name="hello_world">Hello world!</string>
1010
<string name="click_to_shoot">开始直播</string>
1111
<string name="start_recording">开始录制</string>
12+
<string name="capture_thumbnail">截屏</string>
1213
<string name="beauty_switcher">美颜</string>
1314
<string name="watermark">水印</string>
1415
<string name="mute">静音</string>

demo/src/com/ksyun/media/streamer/demo/CameraActivity.java

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import android.content.Intent;
99
import android.content.pm.ActivityInfo;
1010
import android.content.pm.PackageManager;
11+
import android.graphics.Bitmap;
1112
import android.graphics.Color;
1213
import android.hardware.Camera;
1314
import android.opengl.GLSurfaceView;
@@ -41,7 +42,12 @@
4142
import com.ksyun.media.streamer.kit.OnPreviewFrameListener;
4243
import com.ksyun.media.streamer.kit.StreamerConstants;
4344
import com.ksyun.media.streamer.logstats.StatsLogReport;
45+
import com.ksyun.media.streamer.util.gles.GLRender;
4446

47+
import java.io.BufferedOutputStream;
48+
import java.io.FileNotFoundException;
49+
import java.io.FileOutputStream;
50+
import java.io.IOException;
4551
import java.util.LinkedList;
4652
import java.util.List;
4753
import java.util.Locale;
@@ -62,6 +68,7 @@ public class CameraActivity extends Activity implements
6268
private View mFlashView;
6369
private TextView mShootingText;
6470
private TextView mRecordingText;
71+
private TextView mCaptureSceenShot;
6572
private CheckBox mWaterMarkCheckBox;
6673
private CheckBox mBeautyCheckBox;
6774
private CheckBox mReverbCheckBox;
@@ -91,6 +98,7 @@ public class CameraActivity extends Activity implements
9198
private String mBgmPath = "/sdcard/test.mp3";
9299
private String mLogoPath = "file:///sdcard/test.png";
93100
private String mRecordUrl = "/sdcard/test.mp4";
101+
private String mScreenShotPath = "/sdcard/test_screenshot.jpg";
94102

95103
private boolean mHWEncoderUnsupported;
96104
private boolean mSWEncoderUnsupported;
@@ -158,6 +166,8 @@ protected void onCreate(Bundle savedInstanceState) {
158166
mShootingText.setOnClickListener(mObserverButton);
159167
mRecordingText = (TextView) findViewById(R.id.click_to_record);
160168
mRecordingText.setOnClickListener(mObserverButton);
169+
mCaptureSceenShot = (TextView) findViewById(R.id.click_to_capture_screenshot);
170+
mCaptureSceenShot.setOnClickListener(mObserverButton);
161171
mDeleteView = findViewById(R.id.backoff);
162172
mDeleteView.setOnClickListener(mObserverButton);
163173
mSwitchCameraView = findViewById(R.id.switch_cam);
@@ -747,9 +757,9 @@ public boolean onError(IMediaPlayer iMediaPlayer, int what, int extra) {
747757
return false;
748758
}
749759
});
760+
mStreamer.getAudioPlayerCapture().getMediaPlayer().setVolume(0.4f, 0.4f);
750761
mStreamer.setEnableAudioMix(true);
751762
mStreamer.startBgm(mBgmPath, true);
752-
mStreamer.getAudioPlayerCapture().getMediaPlayer().setVolume(0.4f, 0.4f);
753763
} else {
754764
mStreamer.stopBgm();
755765
}
@@ -778,6 +788,28 @@ private void onAudioOnlyChecked(boolean isChecked) {
778788
mStreamer.setAudioOnly(isChecked);
779789
}
780790

791+
private void onCaptureScreenShotClick() {
792+
mStreamer.requestScreenShot(new GLRender.ScreenShotListener() {
793+
@Override
794+
public void onBitmapAvailable(Bitmap bitmap) {
795+
BufferedOutputStream bos = null;
796+
try {
797+
bos = new BufferedOutputStream(new FileOutputStream(mScreenShotPath));
798+
if (bitmap != null)
799+
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, bos);
800+
} catch (FileNotFoundException e) {
801+
e.printStackTrace();
802+
} finally {
803+
if (bos != null) try {
804+
bos.close();
805+
} catch (IOException e) {
806+
e.printStackTrace();
807+
}
808+
}
809+
}
810+
});
811+
}
812+
781813
private class ButtonObserver implements View.OnClickListener {
782814
@Override
783815
public void onClick(View view) {
@@ -797,6 +829,9 @@ public void onClick(View view) {
797829
case R.id.click_to_record:
798830
onRecordClick();
799831
break;
832+
case R.id.click_to_capture_screenshot:
833+
onCaptureScreenShotClick();
834+
break;
800835
default:
801836
break;
802837
}

docs/assets/navtree_data.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/classes.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,12 @@ <h2 id="letter_G">G</h2>
451451
</tr>
452452

453453

454+
<tr class="alt-color api apilevel-" >
455+
<td class="jd-linkcol"><a href="./com/ksyun/media/streamer/util/gles/GLRender.ScreenShotListener.html">GLRender.ScreenShotListener</a></td>
456+
<td class="jd-descrcol" width="100%">&nbsp;</td>
457+
</tr>
458+
459+
454460
</table>
455461

456462

docs/reference/com/ksyun/media/streamer/filter/audio/AudioMixer.html

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,42 @@ <h2>Summary</h2>
486486

487487

488488

489+
float
490+
</td>
491+
<td class="jd-linkcol" width="100%">
492+
<span class="sympad"><a href="../../../../../../com/ksyun/media/streamer/filter/audio/AudioMixer.html#getInputVolume(int)">getInputVolume</a></span>(int idx)
493+
494+
<div class="jd-descrdiv">return input audio source volume</div>
495+
496+
</td></tr>
497+
498+
499+
500+
<tr class=" api apilevel-" >
501+
<td class="jd-typecol">
502+
503+
504+
505+
506+
507+
boolean
508+
</td>
509+
<td class="jd-linkcol" width="100%">
510+
<span class="sympad"><a href="../../../../../../com/ksyun/media/streamer/filter/audio/AudioMixer.html#getMute()">getMute</a></span>()
511+
512+
<div class="jd-descrdiv">check if audio muted or not</div>
513+
514+
</td></tr>
515+
516+
517+
518+
<tr class="alt-color api apilevel-" >
519+
<td class="jd-typecol">
520+
521+
522+
523+
524+
489525
<a href="../../../../../../com/ksyun/media/streamer/framework/SinkPin.html">SinkPin</a>&lt;<a href="../../../../../../com/ksyun/media/streamer/framework/AudioBufFrame.html">AudioBufFrame</a>&gt;
490526
</td>
491527
<td class="jd-linkcol" width="100%">
@@ -1084,6 +1120,87 @@ <h5 class="jd-tagtitle">Parameters</h5>
10841120
</div>
10851121

10861122

1123+
<a id="getInputVolume(int)"></a>
1124+
1125+
<div class="jd-details api apilevel-">
1126+
<h4 class="jd-details-title">
1127+
<span class="normal">
1128+
public
1129+
1130+
1131+
1132+
1133+
float
1134+
</span>
1135+
<span class="sympad">getInputVolume</span>
1136+
<span class="normal">(int idx)</span>
1137+
</h4>
1138+
<div class="api-level">
1139+
<div>
1140+
1141+
</div>
1142+
1143+
1144+
1145+
</div>
1146+
<div class="jd-details-descr">
1147+
1148+
<div class="jd-tagdata jd-tagdescr"><p>return input audio source volume</p></div>
1149+
<div class="jd-tagdata">
1150+
<h5 class="jd-tagtitle">Parameters</h5>
1151+
<table class="jd-tagtable">
1152+
<tr>
1153+
<th>idx</th>
1154+
<td>SinkPin index</td>
1155+
</tr>
1156+
</table>
1157+
</div>
1158+
<div class="jd-tagdata">
1159+
<h5 class="jd-tagtitle">Returns</h5>
1160+
<ul class="nolist"><li>volume in [0.0f-1.0f]
1161+
</li></ul>
1162+
</div>
1163+
1164+
</div>
1165+
</div>
1166+
1167+
1168+
<a id="getMute()"></a>
1169+
1170+
<div class="jd-details api apilevel-">
1171+
<h4 class="jd-details-title">
1172+
<span class="normal">
1173+
public
1174+
1175+
1176+
1177+
1178+
boolean
1179+
</span>
1180+
<span class="sympad">getMute</span>
1181+
<span class="normal">()</span>
1182+
</h4>
1183+
<div class="api-level">
1184+
<div>
1185+
1186+
</div>
1187+
1188+
1189+
1190+
</div>
1191+
<div class="jd-details-descr">
1192+
1193+
<div class="jd-tagdata jd-tagdescr"><p>check if audio muted or not</p></div>
1194+
<div class="jd-tagdata">
1195+
<h5 class="jd-tagtitle">Returns</h5>
1196+
<ul class="nolist"><li>true if muted, false otherwise
1197+
</li></ul>
1198+
</div>
1199+
1200+
</div>
1201+
</div>
1202+
1203+
10871204
<a id="getSinkPin(int)"></a>
10881205

10891206
<div class="jd-details api apilevel-">

0 commit comments

Comments
 (0)