コード例 #1
0
 @Override
 public void onClick(View v) {
   if (mBroadcaster.isRecording()) {
     showEndBroadcastConfirmationDialog();
   } else {
     setBannerToBufferingState();
     mBroadcaster.startRecording();
     stopMonitoringOrientation();
     //                v.setBackgroundResource(R.drawable.red_dot_stop);
   }
 }
コード例 #2
0
 public static BroadcastFragment getInstance() {
   if (mFragment == null) {
     // We haven't yet created a BroadcastFragment instance
     mFragment = recreateBroadcastFragment();
   } else if (mBroadcaster != null && !mBroadcaster.isRecording()) {
     // We have a leftover BroadcastFragment but it is not recording
     // Treat it as finished, and recreate
     mFragment = recreateBroadcastFragment();
   } else {
     Log.i(TAG, "Recycling BroadcastFragment");
   }
   return mFragment;
 }
コード例 #3
0
  @Override
  public void onResume() {
    super.onResume();

    MainActivity.userBusyNow = true;

    if (mBroadcaster != null) {
      mBroadcaster.onHostActivityResumed();

      if (!mBroadcaster.isRecording()) {
        setBannerToBufferingState();
        mBroadcaster.startRecording();
      }
    }
    //        startMonitoringOrientation();
  }
コード例 #4
0
 /**
  * Force this fragment to stop broadcasting. Useful if your application wants to stop broadcasting
  * when a user leaves the Activity hosting this fragment
  */
 public void stopBroadcasting() {
   if (mBroadcaster.isRecording()) {
     mBroadcaster.stopRecording();
     mBroadcaster.release();
   }
 }
コード例 #5
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (VERBOSE) Log.i(TAG, "onCreateView");

    View root;
    if (mBroadcaster != null
        && getActivity().getResources().getConfiguration().orientation
            == Configuration.ORIENTATION_PORTRAIT) {
      root = inflater.inflate(R.layout.fragment_broadcast, container, false);
      initializeCommentList(root);

      CustomFrameLayout fragmentBroadcastMainLayout =
          (CustomFrameLayout) root.findViewById(R.id.fragmentBroadcastMainLayout);
      fragmentBroadcastMainLayout.setDoubleTapCallback(this);

      mCameraView = (GLCameraEncoderView) root.findViewById(R.id.cameraPreview);
      mCameraView.setKeepScreenOn(true);
      mCameraView.setBackgroundResource(R.color.transparentBlue84);

      preparingBroadcastTextView = (TextView) root.findViewById(R.id.preparingBroadcastTextView);
      mBroadcaster.setPreviewDisplay(mCameraView);

      this.mediaPlayerFooterLayout = root.findViewById(R.id.mediaPlayerFooterLayout);
      this.mediaPlayerFooterLayout.setVisibility(View.INVISIBLE);
      this.mediaPlayerHeaderLayout = root.findViewById(R.id.mediaPlayerHeaderLayout);
      this.mediaPlayerHeaderLayout.setVisibility(View.INVISIBLE);
      this.mediaPlayerLiveTextView = root.findViewById(R.id.mediaPlayerLiveTextView);

      this.mediaPlayerHeaderImageView =
          (ImageView) root.findViewById(R.id.mediaPlayerHeaderImageView);
      this.mediaPlayerUsernameTextView =
          (TextView) root.findViewById(R.id.mediaPlayerUsernameTextView);
      this.mediaPlayerLocationTextView =
          (TextView) root.findViewById(R.id.mediaPlayerLocationTextView);
      this.mediaPlayerWatchersCountTextView =
          (TextView) root.findViewById(R.id.mediaPlayerWatchersCountTextView);
      this.mediaPlayerStreamTitle = (TextView) root.findViewById(R.id.mediaPlayerStreamTitle);
      this.bandwithTooLowLayout = root.findViewById(R.id.bandwithTooLowLayout);
      View mediaPlayerAddCommentEditText = root.findViewById(R.id.mediaPlayerAddCommentEditText);
      mediaPlayerAddCommentEditText.setVisibility(View.GONE);

      //            this.broadcastingTitleEditText =
      // root.findViewById(R.id.broadcastingTitleEditText);
      //            recordButton.setOnClickListener(mRecordButtonClickListener);
      View closeViewButton = root.findViewById(R.id.mediaPlayerCloseViewButton);
      closeViewButton.setOnClickListener(mRecordButtonClickListener);

      //            mLiveBanner.setOnClickListener(mShareButtonClickListener);

      /*            if (mBroadcaster.isLive()) {
                      setGuiToReadyState();
                      mLiveBanner.setVisibility(View.VISIBLE);
                  }
      */
      if (mBroadcaster.isRecording()) {
        //                recordButton.setBackgroundResource(R.drawable.red_dot_stop);
        if (!mBroadcaster.isLive()) {
          setBannerToBufferingState();
          //                    mLiveBanner.setVisibility(View.VISIBLE);
        } else {
          setGuiToReadyState();
        }
      } else {
        handleRecordingStopped();
      }
      setupFilterSpinner(root);
      setupCameraFlipper(root);
    } else root = new View(container.getContext());
    return root;
  }
コード例 #6
0
 @Override
 public void onDestroy() {
   super.onDestroy();
   if (mBroadcaster != null && !mBroadcaster.isRecording()) mBroadcaster.release();
 }