Results 1 to 2 of 2

Thread: Dynamically Inject Metadata to Live Stream (RTMP and HLS)

  1. #1
    Join Date
    Feb 2016
    Posts
    1

    Default Dynamically Inject Metadata to Live Stream (RTMP and HLS)

    Hello all,

    I am looking for a way to dynamically inject arbitrary metadata (for use as cue point) into a live stream and then get the metadata back in JWPlayer in different browsers (for both RTMP and HLS). After reading through various articles on this forum, I tried the following two methods as part of a HTTPProvider but neither of them works.

    Try 1.
    private boolean injectMetaData(IMediaStream stream, String payload) {
    		if (stream != null) {
    			AMFDataObj amfData = new AMFDataObj();
    			
    			amfData.put("payload", payload);
    			stream.sendDirect("payload", amfData);
    
    			return true;
    		}
    		
    		return false;
    	}
    Try 2.
    private boolean injectMetaData(IMediaStream stream, String payload) {
    		if (stream != null) {
    			AMFDataList amfList = new AMFDataList();
    			
    			amfList.add(new AMFDataItem("@setDataFrame"));
    			amfList.add(new AMFDataItem("onMetaData"));
    			
    			AMFDataMixedArray metaData = new AMFDataMixedArray();
    			
    			metaData.put("payload", payload);
    			
    			amfList.add(metaData);
    			
    			synchronized(stream) {
    				byte[] dataData = amfList.serialize();
    				int size = dataData.length;
    				long timecode = Math.max(stream.getAudioTC(), stream.getVideoTC());
    				
    				stream.setDataTC(timecode);
    				stream.setDataSize(size);
    				stream.startDataPacket();
    				stream.addDataData(dataData, 0, size);
    			}
    			
    			return true;
    		}
    		
    		return false;
    	}
    The calls to the HTTPProvider completed successfully in both cases, but when trying to get the metadata back in JWPlayer in the browser, the custom metadata never showed up.

    Here is how I am getting the metadata with JWPlayer:
    jwplayer('player').on('meta', function(evt) {
        console.log(evt.metadata);
    };
    What would be the correct way of doing this?

    Thanks,
    - Derrick

  2. #2
    Join Date
    Jan 2016
    Posts
    81

    Default

    The following articles should be helpful.

    This is an example of how to inject cue points into a live stream using the onTextData method:
    How-to-inject-cue-points-or-metadata

    This is an example of how to convert to ID3 tags for use with HLS streams:
    How-to-convert-onTextData-events-in-a-live-or-VOD-stream-to-timed-events-(ID3-tags)-in-an-Apple-HLS-stream

    Andy E

Similar Threads

  1. Inject metadata to live hls stream serverside
    By Eliont in forum Live Streaming and Encoder Discussion
    Replies: 2
    Last Post: 12-01-2015, 08:25 AM
  2. Inject timed metadata to live hls stream
    By Eliont in forum Wowza Streaming Server Java API
    Replies: 2
    Last Post: 10-29-2015, 09:10 PM
  3. Replies: 2
    Last Post: 07-15-2015, 06:08 AM
  4. Inject ID3/MetaData into Audio only Streams and maintain metadata throughout restream
    By brandone1 in forum Wowza Streaming Engine functionality
    Replies: 0
    Last Post: 08-15-2013, 01:17 PM
  5. Replies: 2
    Last Post: 12-19-2011, 03:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •