public class

Kickflip

extends Object
java.lang.Object
   ↳ io.kickflip.sdk.Kickflip

Class Overview

This is a top-level manager class for all the fundamental SDK actions. Herer you can register your Kickflip account credentials, start a live broadcast or play one back.

Setup

Before use Kickflip must be setup with your Kickflip Client ID and Client Secret with setup(android.content.Context, String, String). These tokens are available in your kickflip account dashboard.

Example Usage

Starting a single live broadcast

  1. setup(android.content.Context, String, String)
  2. (Optional) setSessionConfig(io.kickflip.sdk.av.SessionConfig)
  3. startBroadcastActivity(android.app.Activity, io.kickflip.sdk.av.BroadcastListener)
The BroadcastActivity will present a standard camera UI with controls for starting and stopping the broadcast. When the broadcast is stopped, BroadcastActivity will finish after notifying onBroadcastStop().


Customizing broadcast parameters

As noted above, you can optionally call setSessionConfig(io.kickflip.sdk.av.SessionConfig) before each call to startBroadcastActivity(android.app.Activity, io.kickflip.sdk.av.BroadcastListener). Here's an example of how to build a SessionConfig with SessionConfig.Builder:

SessionConfig config = new SessionConfig.Builder(mRecordingOutputPath)
 .withTitle(Util.getHumanDateString())
 .withDescription("Example Description")
 .withVideoResolution(1280, 720)
 .withVideoBitrate(2 * 1000 * 1000)
 .withAudioBitrate(192 * 1000)
 .withAdaptiveStreaming(true)
 .withVerticalVideoCorrection(true)
 .withExtraInfo(extraDataMap)
 .withPrivateVisibility(false)
 .withLocation(true)
 .build();
Kickflip.setSessionConfig(config);

Note that SessionConfig is initialized with sane defaults for a 720p broadcast. Every parameter is optional.

Summary

Public Constructors
Kickflip()
Public Methods
static void addLocationToStream(Context context, Stream stream, EventBus eventBus)
Convenience method for attaching the current reverse geocoded device location to a given Stream
static KickflipApiClient getApiClient(Context context, KickflipCallback callback)
Create a new instance of the KickflipApiClient if one hasn't yet been created, or the provided API keys don't match the existing client.
static KickflipApiClient getApiClient(Context context)
Create a new instance of the KickflipApiClient if one hasn't yet been created, or the provided API keys don't match the existing client.
static String getApiKey()
Get the provided Kickflip Client Key
static String getApiSecret()
Get the provided Kickflip Client Secret
static BroadcastListener getBroadcastListener()
Get the BroadcastListener to be notified on broadcast events.
static String getStreamIdFromKickflipUrl(Uri uri)
Given a Kickflip.io url, return the stream id.
static boolean isKickflipUrl(Uri uri)
Return whether the given Uri belongs to the kickflip.io authority.
static boolean isKitKat()
Returns whether the current device is running Android 4.4, KitKat, or newer KitKat is required for certain Kickflip features like Adaptive bitrate streaming
static boolean readyToBroadcast()
Check whether credentials required for broadcast are provided
static void setBroadcastListener(BroadcastListener listener)
Set a BroadcastListener to be notified on broadcast events.
static void setSessionConfig(SessionConfig config)
Set the SessionConfig responsible for configuring this broadcast.
static KickflipApiClient setup(Context context, String key, String secret, KickflipCallback cb)
Register with Kickflip, creating a new user identity per app installation.
static KickflipApiClient setup(Context context, String key, String secret)
Register with Kickflip, creating a new user identity per app installation.
static void startBroadcastActivity(Activity host, BroadcastListener listener)
static void startMediaPlayerActivity(Activity host, String streamUrl, boolean newTask)
Start MediaPlayerActivity.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Kickflip ()

Public Methods

public static void addLocationToStream (Context context, Stream stream, EventBus eventBus)

Convenience method for attaching the current reverse geocoded device location to a given Stream

Parameters
context the host application android.content.Context
stream the Stream to attach location to
eventBus an com.google.common.eventbus.EventBus to be notified of the complete action

public static KickflipApiClient getApiClient (Context context, KickflipCallback callback)

Create a new instance of the KickflipApiClient if one hasn't yet been created, or the provided API keys don't match the existing client.

Parameters
context the context of the host application
callback an optional callback to be notified with the Kickflip user corresponding to the provided API keys.

public static KickflipApiClient getApiClient (Context context)

Create a new instance of the KickflipApiClient if one hasn't yet been created, or the provided API keys don't match the existing client.

Parameters
context the context of the host application

public static String getApiKey ()

Get the provided Kickflip Client Key

Returns
  • the provided Kickflip Client Key

public static String getApiSecret ()

Get the provided Kickflip Client Secret

Returns
  • the provided Kickflip Client Secret

public static BroadcastListener getBroadcastListener ()

Get the BroadcastListener to be notified on broadcast events.

public static String getStreamIdFromKickflipUrl (Uri uri)

Given a Kickflip.io url, return the stream id.

e.g: https://kickflip.io/39df392c-4afe-4bf5-9583-acccd8212277/ returns "39df392c-4afe-4bf5-9583-acccd8212277"

Parameters
uri the uri to test
Returns
  • the last path segment of the given uri, corresponding to the Kickflip Stream#mStreamId

public static boolean isKickflipUrl (Uri uri)

Return whether the given Uri belongs to the kickflip.io authority.

Parameters
uri uri to test
Returns
  • true if the uri is of the kickflip.io authority.

public static boolean isKitKat ()

Returns whether the current device is running Android 4.4, KitKat, or newer KitKat is required for certain Kickflip features like Adaptive bitrate streaming

public static boolean readyToBroadcast ()

Check whether credentials required for broadcast are provided

Returns
  • true if credentials required for broadcast are provided. false otherwise

public static void setBroadcastListener (BroadcastListener listener)

Set a BroadcastListener to be notified on broadcast events.

Parameters
listener a BroadcastListener

public static void setSessionConfig (SessionConfig config)

Set the SessionConfig responsible for configuring this broadcast.

Parameters
config the SessionConfig responsible for configuring this broadcast.

public static KickflipApiClient setup (Context context, String key, String secret, KickflipCallback cb)

Register with Kickflip, creating a new user identity per app installation.

Parameters
context the host application's Context
key your Kickflip Client Key
secret your Kickflip Client Secret
cb A callback to be invoked when Kickflip user credentials are available.
Returns

public static KickflipApiClient setup (Context context, String key, String secret)

Register with Kickflip, creating a new user identity per app installation.

Parameters
context the host application's Context
key your Kickflip Client Key
secret your Kickflip Client Secret
Returns

public static void startBroadcastActivity (Activity host, BroadcastListener listener)

Start BroadcastActivity. This Activity facilitates control over a single live broadcast.

Must be called after setup(android.content.Context, String, String) or setup(android.content.Context, String, String, io.kickflip.sdk.api.KickflipCallback).

Parameters
host the host android.app.Activity initiating this action
listener an optional BroadcastListener to be notified on broadcast events

public static void startMediaPlayerActivity (Activity host, String streamUrl, boolean newTask)

Start MediaPlayerActivity. This Activity facilitates playing back a Kickflip broadcast.

Must be called after setup(android.content.Context, String, String) or setup(android.content.Context, String, String, io.kickflip.sdk.api.KickflipCallback).

Parameters
host the host Activity initiating this action
streamUrl a path of format https://kickflip.io/ or https://xxx.xxx/xxx.m3u8
newTask Whether this Activity should be started as part of a new task. If so, when this Activity finishes the host application will be concluded.