Video Feed

Currently, there are five source types of video feed:

  • Discover

  • Channel

  • Playlist

  • Playlist Group

  • Dynamic Content

  • Hashtag Playlist(Only supported on iOS)

Integration

import {
  VideoFeed,
} from 'react-native-firework-sdk';

// discover
<VideoFeed 
  style={{ height: 200 }} 
  source="discover" 
/>

// channel
<VideoFeed 
  style={{ height: 200 }} 
  source="channel" 
  mode="row"
  channel="your encoded channel id"
/>

// playlist
<VideoFeed 
  style={{ height: 200 }} 
  source="playlist" 
  mode="row"
  playlist="your encoded playlist id"
  channel="your encoded channel id"
/>

// playlist group
<VideoFeed 
  style={{ height: 200 }} 
  source="playlistGroup" 
  mode="row"
  playlistGroup="your encoded playlist group id"
/>

// dynamic content
<VideoFeed 
  style={{ height: 200 }} 
  source="dynamicContent" 
  mode="row"
  channel="your encoded channel id"
  dynamicContentParameters={{
    '<cohort key>': ['<cohort value1>', '<cohort value2>'],
  }}
/>

// hashtag playlist
<VideoFeed 
  style={{ height: 200 }} 
  source="hashtagPlaylist" 
  mode="row"
  channel="your encoded channel id"
  hashtagFilterExpression="<hashtag filter expression>"
/>

Please refer to the Encoded IDs help article to learn about how to find your encoded channel ID, playlist ID and playlist group ID.

Mode

VideoFeed component supports three modes: row, column, and grid.

Use grid mode:

<VideoFeed
  style={{ flex: 1 }}
  source="discover"
  mode="grid"
/>

Video feed configuration

VideoFeed component provides videoFeedConfiguration prop for configuring Video Feed. The current configurable are backgroundColor, cornerRadius, and titlePosition etc. Please refer to VideoFeedConfiguration for more details.

<VideoFeed
  style={{ height: 200 }}
  source="discover"
  videoFeedConfiguration={{
    title: { hidden: false },
    titlePosition: 'nested',
    enableAutoplay: true,
  }}
/>

Video player configuration

VideoFeed component provides videoPlayerConfiguration prop for configuring Video Player. The current configurable are playerStyle, videoCompleteAction, and ctaButtonStyle etc. Please refer to VideoPlayerConfiguration for more details.

<VideoFeed
  style={{ height: 200 }}
  source="discover"
  videoPlayerConfiguration={{
    playerStyle: 'full',
    videoCompleteAction: 'advanceToNext',
    showShareButton: true,
  }}
/>

Video feed loading result callback

VideoFeed component provides onVideoFeedLoadFinished prop for setting video feed loading result callback.

<VideoFeed
  style={{ height: 200 }}
  source="discover"
  onVideoFeedLoadFinished={(error) => {
  /**
    * if error is undefined, it means that video feed loaded successfully. 
    * Otherwise, it means that video feed failed to load.
    */
  console.log('onVideoFeedLoadFinished error', error);
  }}
/>

Force refreshing video feed

const feedRef = useRef<VideoFeed>(null);

const handleRefresh = () => {
  //force refreshing video feed
  feedRef.current?.refresh();
};

<VideoFeed 
  style={{ height: 200 }} 
  source="discover"
  ref={feedRef} 
/>

<Button
  onPress={handleRefresh}
  title="Refresh"
/>

Floating Player(Only supported on iOS)

You could set enablePictureInPicture to true to enable the floating player.

<VideoFeed
  style={{ height: 200 }}
  source="discover"
  enablePictureInPicture=true
/>

OS Picture in Picture(Only supported on iOS)

You also need to set enablePictureInPicture to true to enable the OS Picture in Picture.

<VideoFeed
  style={{ height: 200 }}
  source="discover"
  enablePictureInPicture=true
/>

This feature allows the user to watch media while the application is in a background state. While in background mode a video will display in a floating, resizable window.

Set up the iOS project

To enable OS Picture in Picture on the iOS side, you also need to add Background Modes capability via Signing & Capabilities in your iOS project settings. More information about this can be found here: Apple Documentation

To use Picture in Picture, we configure the app to support background audio playback. See Configuring the Audio Playback of iOS and tvOS Apps for more details.

Reference

VideoFeed

IVideoFeedProps

Last updated