-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from ksvc/v2.6.1-22966
update to v2.6.1-22966
- Loading branch information
Showing
12 changed files
with
701 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
KSYLiveDemo/app/src/main/java/com/ksyun/media/streamer/demo/AudioDemoFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
Oops, something went wrong.