protected void setupBroadcaster() {
   // By making the recorder static we can allow
   // recording to continue beyond this fragment's
   // lifecycle! That means the user can minimize the app
   // or even turn off the screen without interrupting the recording!
   // If you don't want this behavior, call stopRecording
   // on your Fragment/Activity's onStop()
   if (getActivity().getResources().getConfiguration().orientation
       == Configuration.ORIENTATION_PORTRAIT) {
     if (mBroadcaster == null) {
       if (VERBOSE)
         Log.i(
             TAG,
             "Setting up Broadcaster for output "
                 + Kickflip.getSessionConfig().getOutputPath()
                 + " client key: "
                 + Kickflip.getApiKey()
                 + " secret: "
                 + Kickflip.getApiSecret());
       // TODO: Don't start recording until stream start response, so we can determine stream
       // type...
       Context context = getActivity().getApplicationContext();
       mBroadcaster =
           new Broadcaster(
               context,
               Kickflip.getSessionConfig(),
               Kickflip.getApiKey(),
               Kickflip.getApiSecret());
       mBroadcaster.getEventBus().register(this);
       mBroadcaster.setBroadcastListener(Kickflip.getBroadcastListener());
       Kickflip.clearSessionConfig();
     }
   }
 }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   if (VERBOSE) Log.i(TAG, "onCreate");
   super.onCreate(savedInstanceState);
   if (!Kickflip.readyToBroadcast()) {
     Log.e(
         TAG,
         "Kickflip not properly prepared by BroadcastFragment's onCreate. SessionConfig: "
             + Kickflip.getSessionConfig()
             + " key "
             + Kickflip.getApiKey()
             + " secret "
             + Kickflip.getApiSecret());
   } else {
     setupBroadcaster();
   }
 }
  @Subscribe
  public void onBroadcastIsReady(final BroadcastIsReadyEvent readyEvent) {
    if (getActivity() != null) {
      mKickflip = Kickflip.getApiClient(getActivity(), null, null);
      final User user = mKickflip.getActiveUser();
      this.user = user;

      getActivity()
          .runOnUiThread(
              new Runnable() {
                @Override
                public void run() {
                  try {
                    setGuiToReadyState();
                    updateUIWithStreamDetails(user);
                  } catch (Exception e) {
                    Log.i(TAG, "onBroadcastIsLiveException");
                    e.printStackTrace();
                  }
                }
              });
    }
  }