Skip to main content

Stream Concurrency

The stream concurrency library is a personalization library that facilitates stream concurrency check during playback and aborts playback if check fails. The library facilitates check for concurrent streams of any content at different stages of playback and abort playback if the number of concurrent streams exceeds allowed limit.

The FLStreamConcurrencyService is the interface for stream check contract which has all the APIs to perform different stream operations (Put & Delete). The FLStreamConcurrencyManager is composed on stream concurrency service to validate stream checks with FLPlayer.

Usage

Create StreamConcurrencyService

Create stream concurrency service
streamConcurrencyService = FLStreamConcurrencyFactory().streamConcurrencyService(endPoint, platformAuthorizer)

Create StreamConcurrencyManager

Create stream concurrency manager
syncInterval = 30000
config = FLStreamConcurrencyFactory().streamConcurrencyConfiguration(endPoint, syncInterval)

' Device id is the unique id with PlatformClient that was used with Content Authorization
m.streamManager = FLStreamConcurrencyFactory().streamConcurrencyManager(config, deviceId, platformAuthorizer)

Stream Check for Content

The FLStreamConcurrencyManager has methods to check streams at different stages of playback. These methods should be invoked on FLPlayer's value change on fields PLAYBACK_STATE and CURRENT_TIME.

Process state change and progress change with stream concurrency manager
sub initializeFLPlayer()
...

m.flPlayer.observeField(m.flPlayerFields.PLAYBACK_STATE, "onPlaybackStateChanged")
m.flPlayer.observeField(m.flPlayerFields.CURRENT_TIME, "onPlayheadPositionChanged")

...
end sub

sub onPlaybackStateChanged(event as Object)
if m.streamManager <> invalid
m.streamManager.processPlaybackStateChange(m.flPlayer)
end if
end sub

sub onPlayheadPositionChanged(event as Object)
if m.streamManager <> invalid
m.streamManager.processProgressChange(m.flPlayer)
end if
end sub