bilibili / ijkplayer

Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.
GNU General Public License v2.0
32.47k stars 8.12k forks source link

onTimedTextListener never called #2940

Open aarondib opened 7 years ago

aarondib commented 7 years ago

k0.7.8.1 version. Added ass, movtext, srt and subrip decoders and ass and srt demuxers. Subtitles tracks selected and deselected correctly: ijkmp_set_stream_selected(3, 1)=0

But onTimedTextListener never called. Please, help! What did I miss?

aarondib commented 7 years ago

Also, I noticed that inspite of selecting subtiles stream: mediaPlayer.getSelectedTrack(ITrackInfo.MEDIA_TRACK_TYPE_TIMEDTEXT) always returns -1

@yuazhen , could you give me any advice?

aarondib commented 7 years ago

I've found the solution (https://github.com/Bilibili/ijkplayer/issues/2700): mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "subtitle", 1);

Further quesion is when a stream has several subtitles tracks, when selecting another subtitle track you need to re-seek to the current position in order to get subtitles. But what to do if it's a live stream?

Also, when a stream has 1) dvbsub 2) subrip - selecting subrip will not show up subtitles.

Thanks!

yuazhen commented 7 years ago

This is indeed a problem. Currently switch between subtitle tracks in a live stream does not immediately display the corresponding subtitle. But you can try reduce subtitle packets queue size to 1 or use multiple queue to buffer all subtitle tracks then display the corresponding subtitle when switched. About the other question, could you offer a sample stream which contains dvdsub and subrip in it?

Android4MediaPlayer commented 7 years ago

@aarondib sample streaming

aarondib commented 7 years ago

https://ufile.io/e90a7

@yuazhen , how about adding DVB subs support? This would be a great feature for the library.

be6ana commented 2 years ago

ijkmp_set_stream_selected

How did you implement subtitles presentation ?