com.qiniu.pili.droid.streaming.StreamingEnv Java Examples

The following examples show how to use com.qiniu.pili.droid.streaming.StreamingEnv. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java    From PLDroidMediaStreaming with Apache License 2.0 6 votes vote down vote up
public void onClickCheckAuth(View v) {
    StreamingEnv.checkAuthentication(new PLAuthenticationResultCallback() {
        @Override
        public void onAuthorizationResult(int result) {
            String authState;
            if (result == PLAuthenticationResultCallback.UnCheck) {
                authState = "UnCheck";
            } else if (result == PLAuthenticationResultCallback.UnAuthorized) {
                authState = "UnAuthorized";
            } else {
                authState = "Authorized";
            }
            Toast.makeText(MainActivity.this, "auth : " + authState, Toast.LENGTH_SHORT).show();
        }
    });
}
 
Example #2
Source File: FlutterQiniucloudLivePlugin.java    From FlutterQiniucloudLivePlugin with Apache License 2.0 5 votes vote down vote up
private FlutterQiniucloudLivePlugin(BinaryMessenger messenger, Context context, MethodChannel channel, PlatformViewRegistry registry) {
    this.context = context;

    // 初始化七牛云
    StreamingEnv.init(context);

    // 初始化七牛云连麦
    RTCMediaStreamingManager.init(context, RTCServerRegion.RTC_CN_SERVER);

    // 注册View
    registry.registerViewFactory(QiniucloudPlayerPlatformView.SIGN, new QiniucloudPlayerPlatformView(context, messenger));
    registry.registerViewFactory(QiniucloudConnectedPlayerPlatformView.SIGN, new QiniucloudConnectedPlayerPlatformView(context, messenger));
    registry.registerViewFactory(QiniucloudPushPlatformView.SIGN, new QiniucloudPushPlatformView(context, messenger));
}
 
Example #3
Source File: MainActivity.java    From PLDroidMediaStreaming with Apache License 2.0 5 votes vote down vote up
public void launchStreaming(View v) {
    // API < M, no need to request permissions, so always true.
    boolean isPermissionOK = Build.VERSION.SDK_INT < Build.VERSION_CODES.M || mPermissionChecker.checkPermission();
    if (!isPermissionOK) {
        Util.showToast(this, "Some permissions is not approved !!!");
        return;
    }

    if (mDebugModeCheckBox.isChecked()) {
        StreamingEnv.setLogLevel(Log.VERBOSE);
    }

    boolean quicEnable = mQuicPushButton.isChecked();
    String streamText = mInputTextTV.getText().toString().trim();

    int pos = mStreamTypeSpinner.getSelectedItemPosition();
    Intent intent = new Intent(this, ACTIVITY_CLASSES[pos]);
    intent.putExtra(StreamingBaseActivity.INPUT_TEXT, streamText);
    intent.putExtra(StreamingBaseActivity.TRANSFER_MODE_QUIC, quicEnable);
    intent.putExtras(mEncodingConfigFragment.getIntent());
    boolean bAudioStereo = ((CheckBox) findViewById(R.id.audio_channel_stereo)).isChecked();
    if (bAudioStereo) {
        intent.putExtra(StreamingBaseActivity.AUDIO_CHANNEL_STEREO, bAudioStereo);
    }
    if (pos == 0) {
        intent.putExtras(mCameraConfigFragment.getIntent());
    }
    startActivity(intent);
}
 
Example #4
Source File: StreamingApplication.java    From PLDroidMediaStreaming with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    /**
     * init must be called before any other func
     */
    StreamingEnv.init(getApplicationContext());

    /**
     * track app background state to avoid possibly stopping microphone recording
     * in screen streaming mode on Android P+
     */
    AppStateTracker.track(this, new AppStateTracker.AppStateChangeListener() {
        @Override
        public void appTurnIntoForeground() {
            stopService();
        }

        @Override
        public void appTurnIntoBackGround() {
            startService();
        }

        @Override
        public void appDestroyed() {
            stopService();
        }
    });
}