Skip to main content
Version: 1.1.7

Standalone player

This option allows you to trigger at will our stories player, from a button click for example.

Layout

You first need to add our player view within your Activity/Fragment layout:

<com.joinstoriessdk.androidsdk.ui.player.StoryPlayer
android:id="@+id/story_player"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@android:color/white"
android:translationZ="16dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

Visibility is hidden by default, and will be handled by the SDK whenever triggered and stories are loaded.

TranslationZ could be usefull to ensure it will be displayed over your other screen widgets.

Trigger

To start the stories fetching and the player display, you need to call the startPlayer method:

JoinStories.startPlayer(
joinStoriesStandaloneConfig,
lifecycleScope,
container_view,
story_player,
listener
)
ParameterTypeRequiredDescription
joinStoriesStandaloneConfigJoinStoriesStandaloneConfigYESThe configuration object, that requires at least the JOIN Stories alias you were given
lifecycleScopeLifecycleCoroutineScopeYESA lifecycle scope bounded to the Android component containing the StoryPlayer implemented previously
containerViewViewYESThe root view containing the StoryPlayer implemented previously. It will only use its visible rect to animate the player appearance/disappearance
storyPlayerStoryPlayerYESThe StoryPlayer implemented previously
listenerJoinStoriesListenerNOA listener allowing you to be notified when the player is started or when an error occured

Configuration

You can fine tune SDK behavior and UI, by specifying optional values of the JoinStoriesStandaloneConfig parameter.

Available configuration parameters:

NameTypeDefault ValueDescription
joinAliasStringThe JOIN Stories alias you were given to configure your integration
timeoutLong10Timeout used for the stories fetching network requests (call and read)
animationOriginEnumPlayerStandaloneAnimationOrigin . BOTTOMThe animation used to show and hide the player.
playerBackgroundColorIntColor.BLACKColor of the player's background, if the player height is smaller than screen dimensions
playerVerticalAnchorPlayerVerticalAnchor.BOTTOMIf the player's height is smaller than screen height, anchor it to the top, bottom or center of the scren
playerShowShareButtonBooleantrueChange the visibility of the share button displayed on the Player view
playerClosingButtonBooleantrueChange the visibility of the close button displayed on the Player view
playerHorizontalMarginsInt0Apply the margin to the left and right of the player view. To maintain ratio, it also changes the height of the player view.
playerCornerRadiusFloat0fApply radius to the 4 corners of the player view
playerProgressBarDefaultColorString?nullChange the background color of the progress bar in the player view. If no value or null is filled, the default color will be used. Format is ##RRGGBB or #RRGGBBAA
playerProgressBarFillColorString?nullChange the fill color of the progress bar in the player view. If no value or null is filled, the default color will be used. Format is ##RRGGBB or #RRGGBBAA
playerProgressBarThicknessInt?nullChange the thickness of the progress bar in the player view. If no value or null is filled, the default thickness will be used.
playerProgressBarRadiusInt?nullChange the radius of the progress bar in the player view. If no value or null is filled, the default thickness will be used. Radius will be applied to the 4 corners.