Storyblock
Storyblock is an embedded player, it provides flexible size and placement to the host application.
Storyblock demo video:
Storyblock_Android.mp4
14MB
Binary
1.Add a FrameLayout into your preferred layout file.
// Example layouts.
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="@+id/yourImageView"
android:layout_width="match_parent"
android:layout_height="300dp"
...
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
/>
<!-- Add FireworkPlayerFragment to your layout file with your preferred size and placement. (Start)-->
<FrameLayout
android:id="@+id/storyblockFragment"
android:layout_width="specify_storyblock_width_here"
android:layout_height="specify_storyblock_height_here"
...
app:layout_constraintTop_toBottomOf="@id/topView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
</FrameLayout>
<!-- Add FireworkPlayerFragment to your layout file with your preferred size and placement. (End)-->
<ProgressBar
android:id="@+id/feedLoadingProgress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Widget.AppCompat.ProgressBar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/storyblockFragment"
app:layout_constraintBottom_toBottomOf="@id/storyblockFragment"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
val playerFragment = FireworkPlayerFragment()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
initializeFireworkSDK()
setContentView(R.layout.activity_main)
val fm = supportFragmentManager
val ft = fm.beginTransaction()
ft.add(R.id.storyblockFragment, playerFragment)
ft.commitNowAllowingStateLoss()
}
private fun initializeFireworkSDK() {
FwSDK.initialize(
applicationContext,
yourClientId,
yourPreferredUserId,
object : FwSDK.SdkStatusListener {
override fun currentStatus(status: SdkStatus, extra: String) {
when (status) {
SdkStatus.Initializing -> {
feedLoadingProgress.visibility = View.VISIBLE
}
SdkStatus.Initialized -> {
//If the host app wants to specify some status before launch the player,
//add VideoPlayerProperties before setStoryBlockParameters() API.
VideoPlayerProperties.enableOneTouchMute = true
VideoPlayerProperties.launchPlayerWithMute = true
VideoPlayerProperties.enablePlayPauseControl = true
//Define feed configurations to setStoryBlockParameters() API with option 1 to 4 by the different feedType.
//Option 1: Discovery feed
playerFragment?.setStoryBlockParameters(FeedType.DISCOVERY)
//Option 2: Channel feed
playerFragment?.setStoryBlockParameters(FeedType.CHANNEL, "your channel id")
//Option 3: Playlist feed
playerFragment?.setStoryBlockParameters(FeedType.PLAYLIST, "your channel id", "your playlist id")
//Option 4: Dynamic Content feed
var customHashMap : HashMap<String, List<String>> = HashMap<String, List<String>>()
customHashMap.put("category", listOf("fashion"))
playerFragment?.setStoryBlockParameters(FeedType.DYANMIC_CONTENT, "your channel id", null, customHashMap)
feedLoadingProgress.visibility = View.GONE
}
}
}
})
}
Last modified 1yr ago