API playback changes
We've made changes to the playbacks API that you need to be aware of!
play_idis generated if omittedplayback_updatesequence has changedreplacement_idtakes userId, not clientId- EyesonJS (< 1.9.0) react to
playback_updateif_src: 'actioncable' - Update EyesonJS to v1.9.0 (npm or yarn)
playback_update event
The playback_update event has changed. It still has the playing list, but this
list from now on contains all playbacks that are currently playing. Before the update,
it only had the playback that started by request and not more.
Furthermore, there is always a play_id for each playback. If you leave this parameter
empty at the request, a play_id will be automatically created. This is important since
you can use this parameter to stop the playback.
// start playback A
{
type: 'playback_update',
playing: [
{ play_id: 'playback-A', url: 'https://...' }
]
}
// start playback B
{
type: 'playback_update',
playing: [
{ play_id: 'playback-A', url: 'https://...' },
{ play_id: 'playback-B', url: 'https://...' }
]
}
// playback A ends, B continues to play
{
type: 'playback_update',
playing: [
{ play_id: 'playback-B', url: 'https://...' }
]
}
// all playbacks end
{
type: 'playback_update',
playing: []
}
Simplified example of new playback_update sequence.
replacement_id
Playback with replacement_id now takes the userId as already
recorded in the documentation. If you have
used the replacement_id with user's clientId before, then be aware that
the playback_update event now returns the userId as replacement_id.
UserId and clientId are usually the same, except if you have explicitly set a
user[id] in the join request or
id in the register guest user request.
EyesonJS playback_update end event
If you're using EyesonJS you have already noticed a playback_update event with
an empty playing list as soon as the playback ends.
With the API playback changes, this event is triggered twice! In order to avoid
the redundant playback end event, please react only to the playback_update event
with _src: 'actioncable' on versions < 1.9.0.
{
type: 'playback_update',
playing: [],
_src: 'actioncable'
}
playback_update event in EyesonJS triggered from API
Update EyesonJS to version 1.9.0 for a clear event handling!
