Sharing Clips
The following section deals only with presenting the ClipShare functionality once you have performed a successful snap with the SnapOdds SDK.
Implementation
Perform Snap via SnapOdds SDK (refer to https://docs.snapodds.com/docs/mobile-sdk/android/snapodds-operator/snapping-games)
Ensure your class conforms to
ClipShareFragmentResultListenerInstantiate
ClipShareFragmentwith the required argumentsHandle the result in your listener implementation
Sharing Clips
The following code illustrates how to present the ClipShareFragment. The recommended way is to present this right after you get the callback from the SnapOdds SDK about a snapped sport event, which is also reflected in this code sample.
override fun snapActivityDidSnapSportEvent(
activity: SnapActivity,
fragment: SnapFragment,
sportEvent: SportEventSnapResultEntry
) {
activity.finish()
val tvChannelId = sportEvent.tvChannel?.id ?: return
val snapTimestamp = sportEvent.timestamp ?: return
val authorizationHeader = Snapscreen.instance?.authorizationHeader ?: return
val epgUnitNameFallback = sportEvent.sportEvent?.league ?: sportEvent.sportEvent?.tournament ?: sportEvent.sportEvent?.sport
parentFragmentManager.beginTransaction()
.replace(
R.id.fragment_container,
ClipShareFragment.newInstance(
tvChannelId = tvChannelId,
tvChannelLogoUrl = sportEvent.tvChannel?.logoURL,
tvChannelName = sportEvent.tvChannel?.name,
epgUnitNameFallback = epgUnitNameFallback,
snapTimestamp = snapTimestamp,
snapscreenAuthorizationHeader = authorizationHeader,
listener = this
)
)
.addToBackStack(ClipShareFragment::class.java.canonicalName)
.commit()
}When the user successfully trims a desired clip, the following method is called in your ClipShareFragmentResultListener:
When the clip could not be created for any reason, the following method is called in your ClipShareFragmentResultListener:
When no clip information for the provided Snap Result could be loaded, the following method is called in your ClipShareFragmentResultListener:
Additionally it is (very rarely) possible that the loaded clip is not long enough to support trimming. In that case the following method is called in your ClipShareFragmentResultListener:
Last updated