-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to add Timed Events to Exoplayer2 #2189
Comments
I have captionslist where each caption contains title, startTime & endTime. how to add these to Exoplayer/embed to subtitle view. Please help in integrating them to Exoplayer and I need to get time event. |
What format are the subtitles provided in? If they're in a standard subtitle format that we support, you can just use ExoPlayer's built in subtitle support. |
Marking this as a general enhancement to support triggers are certain positions in the media. It's unclear whether that's really what the original poster wants, but request was never clarified. |
do u know if is this being worked on for an upcoming release ? |
It's being worked on. But not for the upcoming 2.6 release. More likely the next one. |
Thank you ! Meanwhile, Is there an example that uses a custom renderer for this purpose (or something similar). I couldn't find anything relevant online or in the demo (could only find usage of SimpleExoPlayer) |
While working on this feature, we came across some edge cases where it's unclear how the new feature should work:
Please let us know which version would fit your requirements best. |
Im not the OP.. but Ill add my 2cents worth. What happens when the player plays the same position twice (e.g. when repeating, or after seeking back). Should the event be fired again or only once? What happens when the player seeks to a position behind the callback position. Should the event still be triggered or only when the playback naturally progresses over the callback position. Should the event be triggered on an app callback thread (slower, but does not block playback) or on the internal playback thread (direct, but blocks playback)? Sorry to bug.. but like Id asked earlier, is there an example that uses a custom renderer that I can use to workaround this. |
@mapsver One way to do this is to subclass
|
thank you.. will try it out this weekend ! |
Thanks for addressing this. I have created a time renderer track to get around this in the past. In regards to your edge cases, I agree with @mapsver that the event should fire every time in forwards playback at normal speed only (no seek over events). But it would be good to have an option to call this on the direct thread for scenarios in which the latency is critical. |
Thanks for your opinions on that matter. We now finished implementing an updated version of
The change will be available on the dev branch soon. |
This adds options to ExoPlayer.sendMessages which allow to specify a window index and position at which the message should be sent. Additionally, the options can be configured to use a custom Handler for the messages and whether the message should be repeated when playback reaches the same position again. The internal player converts these window positions to period index and position at the earliest possibility. The internal player also attempts to update these when the source info is refreshed. A sorted list of pending posts is kept and the player triggers these posts when the playback position moves over the specified position. Issue:#2189 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=179563355
This adds options to ExoPlayer.sendMessages which allow to specify a window index and position at which the message should be sent. Additionally, the options can be configured to use a custom Handler for the messages and whether the message should be repeated when playback reaches the same position again. The internal player converts these window positions to period index and position at the earliest possibility. The internal player also attempts to update these when the source info is refreshed. A sorted list of pending posts is kept and the player triggers these posts when the playback position moves over the specified position. Issue:#2189 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=179683841
This functionality is now available to try in the dev-v2 branch. |
@tonihei Could you provide an example of this new feature with SimpleExoPlayer? I would like to add a timed event, but I don't know what argument pass to createMessage function (target argument), because I don't have access to video renderers. This is how I'm creating my ExoPlayer in my Activity:
And I want to add a handler when test.mp4 video reach 1500ms. Something like that:
Any suggestion and clarification will be very helpful! Thank you a lot |
@JesusMartinAlonso You can provide your own message target in there to receive the message at the specified time (see interface here). For example:
|
Thank you for your super fast response @tonihei !! It works like a charm! :) |
@tonihei is not available in |
@tonihei but I am using |
|
Hi,
Need API to add timed events to Exoplayer2
I have 3 events in a video of duration (03:00), I need to get timed event when the time stamp crosses(00:45, 01:50 & 02:30). What should be done to add these events.
Thanks And Regards,
Kashyap Tadikonda
The text was updated successfully, but these errors were encountered: