Wowza Community

IMediaStreamFileMapper -> streamToFileForRead called multiple times per video

Hello guys,

I’m totally new to the wowza community, I’ve developed a small plugin module to find the videos location in a DB when requested by ID creating a class that extends the IMediaStreamFileMapper and registering the mapper onAppStart with appInstance.setStreamFileMapper(mapperInstance)

What I quickly noticed is that the streamToFileForRead method of the mapper is called multiple (5-6) times per video despite it returns always the same output which causes multiple database requests as you can imagine … an unwanted behaviour. So as I was not able to find documentation on the subject - is this behaviour by design? Is this thing somehow a subject of configuration? Or is it a problem with the way I register the mapper? What can I do to prevent it except of caching data retrieved once from the database?

Thanks in advance for the help!

I’m using server version 4.4

Hello

The IMediaStreamFileMapper event handler is called upon for each read/write. One implementation example is here.

Thanks,

Matt

Hello

Ya that event handler will be invoked several times per read etc. Another approach may be to take a look at the following module from our collection. The RandomAccessReaderSourceSelector class gives an implementation where you could leverage the IRandomAccessReader interface and access your asset initially via the init() event.

Thanks,

Matt

Hello Matt,

Thank you for the response … but it does not really answer my question. What happens in my case is that for one read operation the streamToFileForRead is called multiple times despite each and every time it returns a (new File(path)) for which (file.exists()) is true.

So my question was - is that normal? I guess reading between the lines of your answer - it isn’t …