Skip to content

Commit

Permalink
Merge pull request #73 from ksvc/v2.6.1-22966
Browse files Browse the repository at this point in the history
update to v2.6.1-22966
  • Loading branch information
chriszeng87 authored Nov 22, 2017
2 parents c34542e + 2fdcc99 commit 42c1eb8
Show file tree
Hide file tree
Showing 12 changed files with 701 additions and 4 deletions.
6 changes: 6 additions & 0 deletions KSYLiveDemo/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@
android:launchMode="singleTop"
android:theme="@style/Theme.RiseAnimation">
</activity>
<activity
android:name="com.ksyun.media.streamer.demo.AudioStreamingActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:launchMode="singleTop"
android:theme="@style/Theme.RiseAnimation">
</activity>

</application>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package com.ksyun.media.streamer.demo;

import com.ksyun.live.demo.R;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.RadioGroup;

import com.ksyun.media.streamer.framework.AVConst;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
* Audio streaming demo fragment.
*/

public class AudioDemoFragment extends DemoFragment {
private static final String TAG = "BaseDemoFragment";

@BindView(R.id.audioBitratePicker)
protected EditText mAudioBitRateEditText;
@BindView(R.id.aac_profile)
protected RadioGroup mAACProfileGroup;

@BindView(R.id.stereo_stream)
protected CheckBox mStereoStream;
@BindView(R.id.autoStart)
protected CheckBox mAutoStartCheckBox;
@BindView(R.id.print_debug_info)
protected CheckBox mShowDebugInfoCheckBox;

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.audio_demo_fragment, container, false);
ButterKnife.bind(this, view);
return view;
}

protected void loadParams(AudioStreamingActivity.AudioStreamConfig config, String url) {
// initial value
config.mAudioKBitrate = 48;
config.mUrl = url;
config.mStereoStream = false;
config.mAudioEncodeProfile = AVConst.PROFILE_AAC_LOW;

// audio bitrate
if (!TextUtils.isEmpty(mAudioBitRateEditText.getText().toString())) {
config.mAudioKBitrate = Integer.parseInt(mAudioBitRateEditText.getText().toString());
}

// audio encode profile
switch (mAACProfileGroup.getCheckedRadioButtonId()) {
case R.id.aac_he:
config.mAudioEncodeProfile = AVConst.PROFILE_AAC_HE;
break;
case R.id.aac_he_v2:
config.mAudioEncodeProfile = AVConst.PROFILE_AAC_HE_V2;
break;
case R.id.aac_lc:
default:
config.mAudioEncodeProfile = AVConst.PROFILE_AAC_LOW;
break;
}

config.mStereoStream = mStereoStream.isChecked();
config.mAutoStart = mAutoStartCheckBox.isChecked();
config.mShowDebugInfo = mShowDebugInfoCheckBox.isChecked();
}

@Override
public void start(String url) {
AudioStreamingActivity.AudioStreamConfig config =
new AudioStreamingActivity.AudioStreamConfig();
loadParams(config, url);
AudioStreamingActivity.startActivity(getActivity(), config, AudioStreamingActivity.class);
}
}
Loading

0 comments on commit 42c1eb8

Please sign in to comment.