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
)
Parameter | Type | Required | Description |
---|---|---|---|
joinStoriesStandaloneConfig | JoinStoriesStandaloneConfig | YES | The configuration object, that requires at least the JOIN Stories alias you were given |
lifecycleScope | LifecycleCoroutineScope | YES | A lifecycle scope bounded to the Android component containing the StoryPlayer implemented previously |
containerView | View | YES | The root view containing the StoryPlayer implemented previously. It will only use its visible rect to animate the player appearance/disappearance |
storyPlayer | StoryPlayer | YES | The StoryPlayer implemented previously |
listener | JoinStoriesListener | NO | A 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:
Name | Type | Default Value | Description |
---|---|---|---|
joinAlias | String | The JOIN Stories alias you were given to configure your integration | |
timeout | Long | 10 | Timeout used for the stories fetching network requests (call and read) |
animationOrigin | Enum | PlayerStandaloneAnimationOrigin . BOTTOM | The animation used to show and hide the player. |
playerBackgroundColor | Int | Color.BLACK | Color of the player's background, if the player height is smaller than screen dimensions |
playerVerticalAnchor | PlayerVerticalAnchor | .BOTTOM | If the player's height is smaller than screen height, anchor it to the top, bottom or center of the scren |
playerShowShareButton | Boolean | true | Change the visibility of the share button displayed on the Player view |
playerClosingButton | Boolean | true | Change the visibility of the close button displayed on the Player view |
playerHorizontalMargins | Int | 0 | Apply the margin to the left and right of the player view. To maintain ratio, it also changes the height of the player view. |
playerCornerRadius | Float | 0f | Apply radius to the 4 corners of the player view |
playerProgressBarDefaultColor | String? | null | Change 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 |
playerProgressBarFillColor | String? | null | Change 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 |
playerProgressBarThickness | Int? | null | Change the thickness of the progress bar in the player view. If no value or null is filled, the default thickness will be used. |
playerProgressBarRadius | Int? | null | Change 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. |