Closed cdongieux closed 6 months ago
It turns out that using player.createMessage() is not accurate
I'm sure the message itself is perfectly accurate, but I assume the delay comes from other places in the set up.
My understanding is that you either pause the original playback (or even keep it running?) at the playback position of the ad insertion point and then send a message to another player to start playing the ad.
Potential issues:
To support your use case properly, I'd recommend integrating with AdsLoader
:
AdsLoader.Provider
in DefaultMediaSourceFactory.setAdsLoaderProvider
and setAdViewProvider
(to specify the ad overlay view). AdsLoader
gets the Player
object in setPlayer
, which allows you to listen to the ad information in the metadata.AdsLoader.EventListener.onAdPlaybackState
with an AdPlaybackState
describing your ad group, the number of ads, their URLs, durations, and how much of the original content needs to be skipped once the ad finished playing.
PLAYED
after it finished playing (you can listen to Player.onPositionDiscontinuity
to discover that.Thank your for your answer.
To be clearer, here are few answers to your questions:
I'll take a look on AdsLoader and let you know. Thanks.
OK, I'm doing some experiments with your advice about using a custom AdsLoader. Is there a way for the original content to not stop playing while an ad is playing? The original content is a live broadcast TS stream with no timeshift buffer, so I'm not able to seek it.
Is there a way for the original content to not stop playing while an ad is playing?
Not really, unless you do it in the way you are already doing it. ExoPlayer's way of integrating with ad playback is to avoid this problem by not loading media twice or holding onto multiple decoders in parallel.
I'm afraid this means my AdsLoader
suggestion won't work I thought it would...
I'm closing this issue because it seems there is no follow-up discussion needed. If this investigation resulted in a new feature request, please file a new one focused on the concrete issue.
Hi,
This question is related to a previous question I asked here. I want to be able to play a TS stream carrying data announcing at what time an ad will start and play with another ExoPlayer instance a replacement ad given by an ad server in place of the ad in the TS stream.
As an input I have a TS stream with a SCTE-35 track (application/x-scte35), this track signals SCTE-35 TimeSignalCommands. I made a development to add support for segmentation descriptors (Section 10.3.3 of the spec) embedded inside TimeSignalCommand. These segmentation descriptors describe ad events (ad server call, break start/end, ad start/end, etc.). All of this data is output as Metadata by SpliceInfoDecoder. When playing the TS stream, I listen to Metadata with
Player.Listener.onMetadata(Metadata)
, I handle TimeSignalCommand with its segmentation descriptors with something like this:It turns out that using
player.createMessage()
is not accurate and there can be a lot of delay (between 10 milliseconds and more than 1 second) between the expected player position at which I want the action to be ran and the actual position. This delay can lead to an inaccurate visual synchronisation between the ad start in the TS video stream and the replacement ad start.So my question is: do you have an idea of a better way to achieve frame accuracy, or at least a better accuracy? Would a custom renderer be a solution?