Quick! 15 min setup.

Camment technology works in your video platform. Camment technology is implemented to your mobile and connected TV applications and web streaming platforms. Implementation is super simple and fast.

iOS SDK implementation

Requirements

To get started with the Camment Mobile SDK for iOS you can set up the SDK and build a new project, or you can integrate the SDK in an existing project To use the SDK, install the following on your development machine: - Xcode 7 or later - iOS 8.1 or later - Cocoapods

Setup Facebook SDK

Skip this step if your ios app has Facebook SDK installed already, but if you don't use it yet please follow the guide: https://developers.facebook.com/docs/ios/getting-started/

Add CammentSDK framework to your Xcode project

Open yout Podfile and add pod 'CammentSDK' there

platform :ios, '8.1'

target 'Your target' do
    use_frameworks!
    pod 'CammentSDK'
end

then run pod install

Configure CammentSDK in project's Info.plist

Add following code to your Info.plist to prevent any restrictions from iOS:

<key>LSRequiresIPhoneOS</key>
    <true/>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>cloudfront.net</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSThirdPartyExceptionMinimumTLSVersion</key>
                <string>TLSv1.0</string>
                <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
            <key>amazonaws.com</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSThirdPartyExceptionMinimumTLSVersion</key>
                <string>TLSv1.0</string>
                <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
            <key>amazonaws.com.cn</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSThirdPartyExceptionMinimumTLSVersion</key>
                <string>TLSv1.0</string>
                <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
        </dict>
        <key>NSAllowsArbitraryLoads</key>
        <false/>
    </dict>
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>camment</string>
            </array>
        </dict>
    </array>
    <key>NSCameraUsageDescription</key>
    <string>Camera is used to create camment chat and have discussions with short videos on your device</string>
    <key>NSMicrophoneUsageDescription</key>
    <string>Microphone is used to create camment chat and have discussions with short videos on your device</string>

Copy custom font to your Xcode project

Camment SDK uses custom fonts Nunito-Medium.ttf and Nunito-Light. Make sure you downloaded fonts from our github and added the files to your project. You can download fonts by the links https://github.com/camment/sdk-ios/blob/master/Nunito-Medium.ttf https://github.com/camment/sdk-ios/blob/master/Nunito-Light.ttf

Declare custom font in Info.plist file

<key>UIAppFonts</key>
<array>
  <string>Nunito-Medium.ttf</string>
  <string>Nunito-Light.ttf</string>
</array>

Set up the SDK in AppDelegate.m

Open AppDelegate.m and import CammentSDK header:

#import <CammentSDK/CammentSDK.h>
#import <CammentSDK/CMFacebookIdentityProvider.h>

Add following lines to AppDelegate


@interface AppDelegate () @property (nonatomic, strong) CMFacebookIdentityProvider *facebookIdentityProvider; @end ... - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions]; [[CammentSDK instance] application:application didFinishLaunchingWithOptions:launchOptions]; ... return YES; } - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options { BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey] annotation:options[UIApplicationOpenURLOptionsAnnotationKey] ]; [[CammentSDK instance] application:application openURL:url options:options]; return handled; } - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(nullable NSString *)sourceApplication annotation:(id)annotation { BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url sourceApplication:sourceApplication annotation:annotation ]; [[CammentSDK instance] openURL:url sourceApplication:sourceApplication annotation:annotation]; return handled; } - (void)applicationDidBecomeActive:(UIApplication *)application { [FBSDKAppEvents activateApp]; [[CammentSDK instance] applicationDidBecomeActive:application]; }

Configure CammentSDK with an API Key

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    ...
    NSString *apiKey = @"YOUR_API_KEY";
    self.facebookIdentityProvider = [CMFacebookIdentityProvider new];
    [[CammentSDK instance] configureWithApiKey:apiKey
                              identityProvider:self.facebookIdentityProvider];
    ...
}

Now you are ready to use CammentSDK.

Add CammentSDK overlay on top of your video player

Open a View Controller where you would like to use CammentSDK and import header

#import <CammentSDK/CammentSDK.h>

Create a new property with CMCammentOverlayController class. This class is a container for all camment overlay internal logic

@property (nonatomic, strong) CMCammentOverlayController *cammentOverlayController;

Before creating Camment overlay we need to provide few configuration options. First of all, create show metadata object which holds identifier of your show:

CMShowMetadata *metadata = [CMShowMetadata new];
metadata.uuid = @"Any string unique identifier of your show";

Show identifier is any string which defines your show. Choose any uuid which is meaningfull for you. After that we need to create an object describing visual configuration for overlay layout.

CMCammentOverlayLayoutConfig *overlayLayoutConfig = [CMCammentOverlayLayoutConfig new];
// Let's display camment button at bottom right corner
overlayLayoutConfig.cammentButtonLayoutPosition = CMCammentOverlayLayoutPositionBottomRight;

Now instantiate controller and add it's subview on your view controller's view:

self.cammentOverlayController = [[CMCammentOverlayController alloc] initWithShowMetadata:metadata overlayLayoutConfig:overlayLayoutConfig];
[self.cammentOverlayController addToParentViewController:self];
[self.view addSubview:[_cammentOverlayController cammentView]];

Layout overlay subview properly:

-(void)viewDidLayoutSubviews {
    [super viewDidLayoutSubviews];
    [[self.cammentOverlayController cammentView] setFrame:self.view.bounds];
}

Now add your player's view to camment overlay. Lets say that name of your player's variable is myPlayerView and it is subclass of UIView.

[self.cammentOverlayController setContentView:myPlayerView];

Check two important things: - myPlayerView doesn't have a superview, means you never add it like [view addSubview: myPlayerView] - you don't add myPlayerView on top of overlay view using default cocoa touch method addSubview. You should you setContentView instead.

Now we are almost done. There is one important thing left. For better user expierence we recommend to mute a video player when user starts recording camment and decrease volume at least by half when user plays camment. In order to do it - implement CMCammentOverlayControllerDelegate protocol:

self.cammentOverlayController.overlayDelegate = self;

The protocol provides four methods to notify your if camment is being recording or playing:

- (void)cammentOverlayDidStartRecording {
    // Mute your player here
}

- (void)cammentOverlayDidFinishRecording {
    // Restore normal volume
}

- (void)cammentOverlayDidStartPlaying {
    // Decrease volume level
}

- (void)cammentOverlayDidFinishPlaying {
    // Restore normal volume
}

Setup CammentSDK UI Delegate

Camment SDK uses UIAlertController to present important messages, like invitations from other users. In order to make UIAlertController will be presented at correct place in view controllers hierarchy we need to handle UI delegate events. UI delegate has a method which will be called when SDK wants to present a notification:

- (void)cammentSDKWantsPresentViewController:(UIViewController * _Nonnull)viewController;

Place where to handle it properly depends on your app architecture, but at very basic setup you can handle this method at visible view controller:

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [CammentSDK instance].sdkUIDelegate = self;
}

- (void)cammentSDKWantsPresentViewController:(UIViewController *_Nonnull)viewController {
    [self presentViewController:viewController animated:YES completion:nil];
}

Setup CammentSDK Delegate

When user joins any gorup SDK will notify you via CMCammentSDKDelegate delegate. Implement CMCammentSDKDelegate wherever it works better for your app. General idea is implement the delegate in an object which can manage internal navigation between screens.

@interface YourRouterObject()<CMCammentSDKDelegate>
@end
- (void)didJoinToShow:(CMShowMetadata *)metadata {
  NSString *showUuid = metadata.uuid;
  // open video player for show with uuid
}

Synchronizing video between group members

CammentSDK makes sure everyone is watching a show at the same time. All the synchronization happens automatically, you just have to make sure that your video player reacts properly to all the events coming from SDK. The first step is providing SDK current playback state from your player. We would recommend to do it every second and immediately when a user presses play/pause buttons, so when playback state has changed you should call

    CMShowMetadata *metadata = [CMShowMetadata new];
    metadata.uuid = @"YOUR_SHOW_IDENTIFIER";
    [[CammentSDK instance] updateVideoStreamStateIsPlaying:isPlaying
                                                      show:metadata
                                                 timestamp:timeInterval];

isPlaying here indicates if your video player paused or not metadata is your show metadata object, you use the same to configure camment overlay timeInterval is current playing position in seconds starting from show beginning

Take a look on a few examples.

    // User watched your show for one minute
    [[CammentSDK instance] updateVideoStreamStateIsPlaying:YES
                                                      show:metadata
                                                 timestamp:60];

    // Then paused video
    [[CammentSDK instance] updateVideoStreamStateIsPlaying:NO
                                                      show:metadata
                                                 timestamp:60];
    // Then started  again
    [[CammentSDK instance] updateVideoStreamStateIsPlaying:YES
                                                      show:metadata
                                                 timestamp:60];
    // After 1 second
    [[CammentSDK instance] updateVideoStreamStateIsPlaying:YES
                                                      show:metadata
                                                 timestamp:61];
    // etc

Sometimes CammentSDK has to know your player state immediately, without waiting until you call the update method. In order to provide player state by request you should implement the required method of CammentOverlayControllerDelegate protocol:

- (void)cammentOverlayDidRequestPlayerState:(void (^)(BOOL isPlaying, NSTimeInterval timestamp))playerStateBlock {
    // call playerStateBlock with current player state
    // Notice that CammentSDK don't need metadata object at the moment
    playerStateBlock(YES, 62);
}

By this moment we have established one-way communication between your video player and CammentSDK, so it knows all about the player position and state. If we want to synchronize video between multiple client SDK should have a way to change player state. To do that your application should subscribe to notification about new timestamps from CammentSDK:


- (void)viewDidLoad { [super viewDidLoad]; ... // here you setup CammentSDK overlay ... // Subscribe to notification about player state [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveNewTimestamp:) name:CMNewTimestampAvailableVideoPlayerNotification object:[CammentSDK instance]]; } - (void)didReceiveNewTimestamp:(NSNotification *)notification { NSDictionary *dict = notification.userInfo; NSTimeInterval newTimestamp = [(NSNumber *)dict[CMNewTimestampKey] doubleValue]; BOOL isPlaying = [(NSNumber *)dict[CMVideoIsPlayingKey] boolValue]; // here you already know if player should be paused or not and the right timestamp // pass those values to your video player }

Android SDK implementation

CammentSDK for Android

current version: 3.0.2

To get started with the Camment Mobile SDK for Android you can set up the SDK and build a new project, or you can integrate the SDK into your existing project.

The instructions were written for the following configuration: - Android Studio 3.1.1 - Java 1.8.0_144 - Gradle 3.1.1 (distribution gradle-4.6-all.zip)

Technical specification

SDK version SDK is built with the following configuration:

minSdkVersion 19
targetSdkVersion 27
compileSdkVersion 27
buildToolsVersion "27.0.3"
supportLibVersion "27.1.0"

Note: If your application supports also lower SDK versions, you have to handle enabling/disabling of the CammentSDK by yourself.

Dependencies CammentSDK relies on following dependencies: - Amazon AWS SDK (v2.6.18) - Facebook SDK (v4.32.0) (part of CammentAuth) - Glide library (v4.7.1) - EasyPermissions library (v1.2.0) - Greenrobot EventBus (v3.0.0) - Android Support v4 (v27.1.0) - Android Support Design Library (v27.1.0) - Android Support RecyclerView (v27.1.0) - Android Support ConstraintLayout (v1.1.0)

(Google Exoplayer (v2.7.3) as internal dependency)

Note: If you use some of these dependencies in your application too, you can remove them from your app gradle file. In case you want to override some dependencies, you can do it using gradle, e.g.:

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '26.0.2'
            }
        }
    }
}

Add CammentSDK to your project

SDK is available on the github in a maven structure, containing 4 important files: - CammentSDK: - cammentsdk-<sdk_version>.aar - cammentsdk-<sdk_version>.pom - CammentAuth: - cammentauth-<sdk_version>.aar - cammentauth-<sdk_version>.pom

Add following repository url into your project level build.gradle file:

allprojects {
    repositories {
        ... // your other repositories
        maven {
            url 'https://raw.githubusercontent.com/camment/sdk-android/master/sdk/'
        }
    }
}

Add following dependencies into your application level build.gradle file:

dependencies {
    ... //your other dependencies
    compile ('tv.camment.cammentsdk:cammentsdk:<sdk_version>@aar') {
        transitive true
    }
    compile ('tv.camment.cammentauth:cammentauth:<sdk_version>@aar') {
        transitive true
    }
}

Note: transitive true means that gradle will download also the SDK dependencies

Now sync the project with your gradle files and clean the project.

CammentAuth - Facebook SDK

CammentSDK requires authentication via Facebook SDK. Currently it is the only option but it's planned to support more options in the future.

If you don't have Facebook SDK set up in your project, you can find instructions how to create and setup Facebook Application here: https://developers.facebook.com/docs/android/getting-started/

Don't forget to add following into the AndroidManifest.xml (more into at https://developers.facebook.com/docs/facebook-login/android):

<application ...>
    ...
    <meta-data
        android:name="com.facebook.sdk.ApplicationId"
        android:value="@string/facebook_app_id" />

    <activity
        android:name="com.facebook.FacebookActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
        android:label="@string/app_name" />

    <activity
        android:name="com.facebook.CustomTabActivity"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="@string/fb_login_protocol_scheme" /> 
        </intent-filter>
    </activity>
    ...
</application>

CammentAuthIdentityProvider

Generally, CammentSDK handles own login/logout (if not logged in, login is called by trying to invite somebody; logout can be called from the side-panel).

If you have already Facebook login/logout functionality on some of your existing activities, call void notifyLogoutSuccessful() explicitly to notify CammentSDK. This way CammentSDK can cleanup data and refresh its UI properly.

CammentSDK.getInstance().getAppAuthIdentityProvider().notifyLogoutSuccessful(); // call when Facebook logout was successful

If you want to be notified about Facebook login/logout performed by CammentSDK, register listener CammentAuthListener:

CammentSDK.getInstance().getAppAuthIdentityProvider().addCammentAuthListener(new CammentAuthListener() {
    @Override
    public void onLoggedIn(CammentAuthInfo cammentAuthInfo) {
        // perform your code after login
    }

    @Override
    public void onLoggedOut() {
        // perform your code after logout
    }
});

Initialize CammentSDK

Open your application class extending Application and add following into the onCreate() method:

public class YourApp extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        ...
        CammentSDK.getInstance().init(this, new FbAuthIdentityProvider()); // CammentSDK initialization
    }
}

Note: Make sure you specified this class also in the AndroidManifest.xml if you didn't use it before:

<application
        android:name=".YourApp"
        ...>

Modify AndroidManifest.xml

Open your application AndroidManifest.xml and add: 1. specify your API key (security of the API key you have to handle by yourself):

<application
    ...>

    <meta-data
        android:name="tv.camment.cammentsdk.ApiKey"
        android:value="YOUR API KEY" />

</application>            
  1. Specify ContentProvider used by CammentSDK as it has to have unique authority:
<application
    ...>

    <provider
            android:name="tv.camment.cammentsdk.data.DataProvider"
            android:authorities="${applicationId}.cammentsdk"
            android:enabled="true"
            android:exported="false" />

</application>            

${applicationId} has to be specified in the application level build.gradle file.

android {
    ...
    defaultConfig {
        applicationId "com.yourapp.yourapp" //replace with your package name
        ...
    }
}

Camment audio recording volume

As Android decreases volume of recorded video in order to compensate sound of microphone membrane, you may notice that the camments recorded on Android device are significantly more quiet than the camments recorded on iOS device. You can decide whether you want to artificially increase camment sound recording or not. Test by yourself which setting is the best for you as by increasing the recording sound it may result in the increased volume of other sounds too, e.g. microphone membrane. To do so use method setCammentAudioVolumeAdjustment(CammentAudioVolume cammentAudioVolume).

public class YourApp extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        ...
        CammentSDK.getInstance().init(this);

        CammentSDK.getInstance().setCammentAudioVolumeAdjustment(CammentAudioVolume.NO_ADJUSTMENT);
    }
}

Camment audio volume adjustment levels are (default value is NO_ADJUSTMENT):

public enum CammentAudioVolume {

    NO_ADJUSTMENT, // original Android recording audio level is used
    MILD_ADJUSTMENT, // original Android recording audio level is increased slightly
    FULL_ADJUSTMENT // original Android recording audio level is increased significantly

}

Add CammentSDK overlay on top of your video player

CammentSDK overlay should be included in the activity which shows video streaming.

<tv.camment.cammentsdk.views.CammentOverlay
        android:id="@+id/camment_overlay"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

CammentSDK overlay should be on top of every other view in the layout (usually defined as last in the layout). Example of layout:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/black"
    tools:context="tv.camment.cammentdemo.CammentMainActivity">

    <FrameLayout
        android:id="@+id/fl_parent"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <VideoView
            android:id="@+id/show_player"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center" />
    </FrameLayout>

    <android.support.v4.widget.ContentLoadingProgressBar
        android:id="@+id/cl_progressbar"
        style="?android:attr/progressBarStyleLarge"
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:visibility="gone"
        android:layout_gravity="center" />

    <tv.camment.cammentsdk.views.CammentOverlay
        android:id="@+id/camment_overlay"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</FrameLayout>

As CammentSDK overlay intercepts all touch events, it has to know to which ViewGroup to pass the touch events in order not to disable underlying components. In the layout above VideoView is wrapped in FrameLayout to enable this. Then in the activity where CammentOverlay is used, call setParentViewGroup(ViewGroup parentViewGroup) method.

CammentSDK also needs to know unique identifier of the currently watched show. Use setShowMetadata(ShowMetadata showMetadata) method. The first parameter of ShowMetadata object is show uuid and the second one is custom invitation text which will be passed together with invitation deeplink (can be null or empty String, in such case default invitation text is used).

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.<your_layout>);
    ...
    CammentSDK.getInstance().setShowMetadata(new ShowMetadata("<Any unique String identifier of your show>", "<Any custom invitation text>"));

    FrameLayout parentViewGroup = (FrameLayout) findViewById(R.id.fl_parent);
    CammentOverlay cammentOverlay = (CammentOverlay) findViewById(R.id.camment_overlay);
    cammentOverlay.setParentViewGroup(parentViewGroup);
}

Bottom margin of the camment recording button can be increased if needed. Use setRecordButtonMarginBottom(int bottomMarginInDp) method of CammentOverlay class to add additional bottom margin (in dp unit). It'll be added to the predefined minimum bottom margin.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.<your_layout>);
    ...

    CammentOverlay cammentOverlay = (CammentOverlay) findViewById(R.id.camment_overlay);
    cammentOverlay.setRecordButtonMarginBottom(16);
    ...
}

Pass onActivityResult and onRequestPermissionsResult to CammentSDK

CammentSDK handles permissions which it needs as well as Facebook Login. In order to complete the flow correctly, pass results of onActivityResult and onRequestPermissionsResult to CammentSDK.

onActivityResult should be overridden in all activities (use your BaseActivity or similar parent activity) where CammentSDK is used as Facebook Login may be performed e.g. when invitation request is received and there has to be an activity ready to receive onActivityResult from Facebook SDK.

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    ...
    CammentSDK.getInstance().onActivityResult(requestCode, resultCode, data);
}

onRequestPermissionsResult should be overridden in the activity where CammentOverlay is used.

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    ...
    CammentSDK.getInstance().onRequestPermissionsResult(requestCode, permissions, grantResults);
}

React to Camment interactions

For better user experience we recommend muting a video player when a user starts recording camment and decrease the volume at least by half when a user plays camment. In order to do it - implement CammentAudioListener interface and set it using method setCammentAudioListener(CammentAudioListener cammentAudioListener). Again this should be done in the activity where CammentSDK Overlay is used.

public interface CammentAudioListener {

    void onCammentPlaybackStarted(); // Decrease player volume

    void onCammentPlaybackEnded(); // Restore normal volume

    void onCammentRecordingStarted(); // Decrease player volume (almost mute)

    void onCammentRecordingEnded(); // Restore normal volume

}

Video Player volume is handled by the host application. Make sure that correct audio volume is used to ensure good user experience, e.g. "onCammentPlaybackStarted" decreases volume to 60% and "onCammentRecordingStarted" decreases volume to 30% of original value.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.<your_layout>);
    ...
    CammentOverlay cammentOverlay = (CammentOverlay) findViewById(R.id.camment_overlay);
    cammentOverlay.setCammentAudioListener(this);
}

Enable video stream syncing in groups

In order to support syncing of position in video stream with host user, implement CammentPlayerListener interface and set it using method setCammentPlayerListener(CammentPlayerListener cammentPlayerListener) of CammentSDK class.

public interface CammentPlayerListener {

    int getCurrentPosition(); //return current position of video stream player in milliseconds (i.e. 1s = 1000ms)

    boolean isPlaying(); //return true if player is currently playing the stream (false if i.e. paused, stopped)

    void onSyncPosition(int currentPosition, boolean isPlaying); //the method will be called by CammentSDK when position should be adjusted - use "currentPosition" value to seek to given position and "isPlaying" to play(true)/pause(false) video stream

}

Example of implementation:

CammentSDK.getInstance().setCammentPlayerListener(new CammentPlayerListener() {
            @Override
            public int getCurrentPosition() {
                return videoView != null ? videoView.getCurrentPosition() : 0;
            }

            @Override
            public boolean isPlaying() {
                return videoView != null && videoView.isPlaying();
            }

            @Override
            public void onSyncPosition(int currentPosition, boolean isPlaying) {
                if (videoView != null) {
                    videoView.seekTo(currentPosition);

                    if (videoView.isPlaying() && !isPlaying) {
                        videoView.pause();
                    } else if (!videoView.isPlaying() && isPlaying) {
                        videoView.start();
                    }
                }
            }
        });

Notify CammentSDK about your player actions using CammentSDK class methods onPlaybackStarted(int currentPositionMillis), onPlaybackPaused(int currentPositionMillis) and onPlaybackPositionChanged(int currentPositionMillis, boolean isPlaying). Example of usage:

public class MyVideoView extends VideoView {

    public MyVideoView(Context context) {
        super(context);
    }

    public MyVideoView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public MyVideoView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public void start() {
        super.start();

        CammentSDK.getInstance().onPlaybackStarted(getCurrentPosition());
    }

    @Override
    public void pause() {
        super.pause();

        CammentSDK.getInstance().onPlaybackPaused(getCurrentPosition());
    }

    @Override
    public void seekTo(int msec) {
        super.seekTo(msec);

        CammentSDK.getInstance().onPlaybackPositionChanged(getCurrentPosition(), isPlaying());
    }
}

DeepLinking

CammentSDK takes care of the invitation deeplinking. It specifies in its manifest CammentDeeplinkActivity which takes care of the deeplinks starting with camment:// scheme. Deeplinks are currently used to join group after an invitation. After the deeplink is opened, dialog is opened and user can decide if he wants to join the group or not. According to your app's activities and flow, you can decide where not to show this dialog, e.g. in the splash screen. To ignore the dialog on given Activity you just need to implement DeeplinkIgnore interface.

public class SplashActivity extends AppCompatActivity 
        implements DeeplinkIgnore

In such case Activity (which doesn't implement DeeplinkIgnore interface) following the SplashActivity will present the invitation dialog.

Deeplinks contain information about a show (show uuid). User should be navigated to the show no matter if he was inviter or invitee. As CammentSDK can't do this for you, implement OnDeeplinkOpenShowListener interface where it is suitable for your code and pass the listener to CammentSDK (in your Application object):

public interface OnDeeplinkOpenShowListener {

    void onOpenShowWithUuid(String showUuid);

}
public class YourApp extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        ...
        CammentSDK.getInstance().init(this);

        CammentSDK.getInstance().setOnDeeplinkOpenShowListener(new OnDeeplinkOpenShowListener() {
            @Override
            public void onOpenShowWithUuid(String showUuid) {
                // your code to open Activity (where CammentOverlay is added) with given showUuid
            }
        });
    }
}

onOpenShowWithUuid will be called by CammentSDK, e.g. when user opens an invitation to join a chat group. You should open your activity with video playback for the given showUuid.