简体   繁体   English

ExoPlayer 正在播放当前录制的媒体文件

[英]ExoPlayer playing currently recording media files

Let me refraise my question, I wrote it in a hurry.让我重新提出我的问题,我很匆忙地写了它。

Current situation: I have set up a digital video recorder to record broadcasts provided via DVB-C.当前情况:我已经设置了一台数字录像机来录制通过 DVB-C 提供的广播。 It is running on a raspberry 3B using TVHeadend and jetty/cling to provide UPnP and other possibilities to access media files.它使用 TVHeadend 和 jetty/cling 在 raspberry 3B 上运行,以提供 UPnP 和其他访问媒体文件的可能性。 For watching recordings, I wrote an android player app using IJKPlayer, which runs on smartphones, FireTV and AndroidTV.为了观看录音,我使用 IJKPlayer 编写了一个 android 播放器应用程序,该应用程序可以在智能手机、FireTV 和 AndroidTV 上运行。 One hassle when playing media files which are currently beeing recorded is, that IJKPlayer doesn not support timeshifting.播放当前正在录制的媒体文件时的一个麻烦是,IJKPlayer 不支持时移。 Means, when I start playing a currently recording file, I can only watch the length which is known by the player at that moment.意思是,当我开始播放当前正在录制的文件时,我只能看到播放器当时知道的长度。 Anything which is recorded afterwards can not be played.之后录制的任何内容都无法播放。 I need to exit the player activity and start it again.我需要退出播放器活动并重新启动它。 I have resolved that issue by "simulating" a completed recoding using a custom servlet implementation.我已经通过使用自定义 servlet 实现“模拟”完成的重新编码来解决该问题。 Since the complete length of the recording is already known, I can use ffmpeg to accomplish this.由于已知录音的完整长度,我可以使用 ffmpeg 来完成此操作。

Future situation: I plan to move away from IJKPlayer to ExoPlayer, because it supports hardware playback and is much faster when playing h.264 media.未来情况:我打算从 IJKPlayer 转移到 ExoPlayer,因为它支持硬件播放并且在播放 h.264 媒体时要快得多。 I can of course use the same solution like above, but as far as I have found out yet, ExoPlayer can support media files which are currently being recorded by using the Timeline class.我当然可以使用与上述相同的解决方案,但据我所知,ExoPlayer 可以支持当前使用时间线 class 录制的媒体文件。 However, I don't seem to find neither a usefull documentation nor any good example.但是,我似乎既没有找到有用的文档,也没有找到任何好的例子。 Hence, I would appreciate any help with the timeline object.因此,我将不胜感激有关时间线 object 的任何帮助。

Regards Harry问候哈利

Looks like my approach won't work.看来我的方法行不通。 At least, I didn't find a solution.至少,我没有找到解决办法。 Problem is, that the server returns the stream size as it is during player-start-time.问题是,服务器在播放器开始时返回 stream 大小。 I didn't find a method to update the media duration for "regular" files.我没有找到更新“常规”文件媒体持续时间的方法。

However, I can solve the problem by changing the server side.但是,我可以通过更改服务器端来解决问题。 Instead of accessing a regular file, I convert the file to m3u8 in realtime, using ffmpeg.我没有访问常规文件,而是使用 ffmpeg 将文件实时转换为 m3u8。 I then throw the m3u8 URI onto the player and it updates the duration of the stream (while playing) without the need to create any additional code on the client side.然后我将 m3u8 URI 扔到播放器上,它会更新 stream 的持续时间(在播放时),而无需在客户端创建任何额外的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM