コード例 #1
0
 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();
     }
   }
 }
コード例 #2
0
 @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();
   }
 }