Wowza Community

Playing only a part of a video/audio file over RTMP with JWPlayer

Hi Wowza community.

We have strict rules on our content so we have to distribute only parts of our audio and video files. We are currently using RTMP as our protocol and we have written a module that sets start time and end time on our files.

This is our current code that overrides play():

AMFDataList customDataList = new AMFDataList();
customDataList.add("play");
customDataList.add(0.0);
customDataList.add("null");
customDataList.add(new AMFDataItem("mp3:"+info.getFileName()));
customDataList.add(new AMFDataItem(info.getOffset()*1000)); // start
customDataList.add(new AMFDataItem(info.getExtent()*1000)); //duration
customDataList.add(new AMFDataItem(true)); //reset
invokePrevious(this, client, function, customDataList);

This code works very well. Our problem is that we are unable to seek in the flash player (JWPlayer) when we cut the file. When we drag the slider the video/audio stops. What can we do to fix this problem?

The problem is that this method does not change the metadata in any of the segments, esp the first segment and especially the metadata “duration”. Take a look at the bottom of this article for how to override duration:

https://www.wowza.com/docs/how-to-insert-a-pre-roll-or-mid-roll-for-video-on-demand-playback-in-flash-rtmp-client

Richard

We’d have to see the rest of the code to make any suggestions. Perhaps the module was not added to the application/stream you were playing.

I have a JWplayer, when I start a stream by Wowza RTMP from my player and debug my code,

only the event onStreamCreate was called, the play () method that i have overridden was not called.

Please help me.

public void play(IClient client, RequestFunction function,
            AMFDataList params) {
        
        getLogger().info("Play Method!");
        
    }