Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration property 'streamPublisherPassPlaylistAttributesAsMetadata' #6

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

pszemus
Copy link
Contributor

@pszemus pszemus commented Feb 24, 2023

Add configuration property streamPublisherPassPlaylistAttributesAsMetadata to specify playlist attributes (can be separated by commas) that will be sent in onMetaData events.

This PR introduces the ability to add custom playlist attributes and pass them, on playlist start, as timed metadata, to the internal stream. This makes it possible to write other modules that can access those timed metadata and create appropriate DASH event messages (https://www.wowza.com/docs/convert-timed-metadata-from-amf-to-emsg-using-the-wowza-streaming-engine-java-api) or HLS ID3 tags (https://www.wowza.com/docs/how-to-convert-ontextdata-events-in-a-live-or-vod-stream-to-timed-events-id3-tags-in-an-apple-hls-stream).

The example usage would be to mark some playlists as ad blocks:

<smil>
	<head>
	</head>
	<body>

		<stream name="test"></stream>

		<playlist name="schedule1" playOnStream="test" repeat="false" scheduled="2000-01-01 00:00:00">
			<video src="mp4:movie.mp4" start="0" length="-1" />
		</playlist>
		<playlist name="schedule2" playOnStream="test" repeat="false" scheduled="2023-02-17 15:36:00" adBreak="true" adBreakType="customType_1">
			<video src="mp4:advertisement_1.mp4" start="0" length="-1" />
			<video src="mp4:advertisement_2.mp4" start="0" length="-1" />
		</playlist>
		<playlist name="schedule3" playOnStream="test" repeat="false" scheduled="2023-02-17 15:37:00">
			<video src="mp4:another_movie.mp4" start="0" length="-1" />
		</playlist>
		<playlist name="schedule4" playOnStream="test" repeat="false" scheduled="2023-02-17 15:36:00" adBreak="true" adBreakType="customType_2">
			<video src="mp4:advertisement_3.mp4" start="0" length="-1" />
			<video src="mp4:advertisement_4.mp4" start="0" length="-1" />
		</playlist>
		<playlist name="schedule5" playOnStream="test" repeat="false" scheduled="2023-02-17 15:40:00">
			<video src="mp4:yet_another_movie.mp4" start="0" length="-1" />
		</playlist>
	</body>
</smil>

then set server/application configuration property streamPublisherPassPlaylistAttributesAsMetadata to adBreak,adBreakType (please notice that attributes can be separated by a comma) and use this information to create SCTE-35 DASH emsg or HLS ID3 tags.

…tadata' to specify playlist attributes that will be sent in onMetaData event
Copy link
Contributor

@rogerlittin rogerlittin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initialise the playlistMetadata map as an empty map so you don't need to do a null or empty check later.

logger.info(CLASS_NAME + " Scheduled stream is now live: " + stream.getName());
AMFDataObj amfData = new AMFDataObj();
playlistMetadata.forEach(amfData::put);
if (amfData.size() > 0)
	stream.getPublisher().getStream().sendDirect("onMetadata", amfData);

@pszemus
Copy link
Contributor Author

pszemus commented Feb 24, 2023

Hi @rogerlittin, I was considering that, but thought that null could indicate that the property is not set, while empty indicates that that the playlist has no arguments specified by the property.
Either way, this distinction is not used anywhere in the code, so I'll go with your suggestion.

@pszemus pszemus requested a review from rogerlittin February 24, 2023 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants