Triggers

Every SMIL media and playlist container can include two trigger attributes. They are represented by the begin and end attributes.

You can define more than one trigger and separate them with a semicolon (;).

Supported Triggers

Currently, garlic-player supports six kind, of triggers in begin and end attributes.

  1. Clock-Values
  2. Wallclock
  3. Syncbase
  4. Accesskey
  5. Touch/Click-Events
  6. Network Trigger

Furthermore, it supports the same value types like dur-attribute (media, indefinite, and clock value).

The Wallclock

Wallclock supports the ISO-8601 datetime specification with repeat periods.

Simple Datetime

2022-04-01T20:00:00
Trigger once on 9:00 AM of April 1, 2022

Weekday

The company IAdea adds with weekday an interesting non-standard feature, which garlic-player also supports.

2022-04-01+w1T00:00:00
Trigger once the first Monday after of April 1, 2022
2022-04-01-w1T00:00:00
Trigger once the first Monday before of April 1, 2022

This can be very helpful, if you want to trigger repeatedly different opening times in the week in shop or common in retail.

Repeated Datetimes

It is possible to include ISO 8601 compatible periods for repeats. The format is: [datetime]P[YY][MM][WW][DD][T[hH][mM][s[.f]S]]

R/2022-04-01T13:00:00/P1D
Trigger once April 1, 2022, at 13:00 and repeat/re-trigger every day continuously

You can also limit the repeats

R12/2022-04-01T12:00:00/PT1H
Trigger once April 1, 2022, at 13:00 and repeat/re-trigger every hour 12 times

You can study a sophisticated real-world example for wallclock triggers.

Syncbase

There are two opportunities, the SMIL syncbase (begin|end) or the similar beginEvent/endEvent. We focus first on syncbase. You can trigger a start or stop of a media with a start or stop of another media. The media which acts as trigger must define a unique ID.

<par xml:id="simple par">
	<video region="screen1" xml:id="video0001" src="0001.mp4" fit="meet" />
	<img region="screen2" src="video.jpg" begin="video0001.begin" end="video0001.end" fit="meet" />
	<img region="screen3" src="end.jpg" begin="video0001.end" dur="indefinite" fit="meet" />
</par>
Video0001 triggers the start of the video.jpg and after end the start of end.jpg

When the video starts in zone 1 it triggers the video.jpg to be shown in zone 2. After ending, it triggers the stop of video.jpg and the beginning of end.jpg.

Compare to the sim event-syntax:

<par xml:id="simple par">
	<video region="screen1" xml:id="video0001" src="0001.mp4" fit="meet" />
	<img region="screen2" src="video.jpg" begin="video0001.beginEvent" end="video0001.endEvent" fit="meet" />
	<img region="screen3" src="end.jpg" begin="video0001.endEvent" dur="indefinite" fit="meet" />
</par>
Same with beginEvent and endEvent

Why are there two Opportunities?

SyncBase is a relict of SMIL 1.0. In this way SMIL 3.0 stay compatible with older SMIL files.

Accesskey

With accesskey you can define a user interaction through a keyboard or sensors (if supported).

accesskey(A)
Trigger when a user hits A on a keyboard

Real-world example for accesskey-triggers

Touch or Mouse Click

The event activateEvent defines an activity via touch screen or mouse click. You have to specify an explicit media ID for that, too.

<excl>
	<priorityClass>
		<video begin="touchme.activateEvent" src="played_after_touch.mkv"/>
	</priorityClass>
	<priorityClass higher="pause">
		<seq begin="0" repeatCount="indefinite">
			<img id="touchme" dur="indefinite" src="touch_me.jpg" />
		</seq>
	</priorityClass>
</excl>
Jumps to video, when touched on an image

This activateEvent will work on images and videos media. It makes no sense to use it while displayed websites or widgets as there are interactive by default and the click will be gone through to website.

In case of a widget, you should better use the network triggers, which we discuss next.

Real-world example for activateEvent

Network Triggers

This is not standard and added by IAdea, but it is so useful, that we implemented it also to the garlic-player from release 0.6.0.

Some SMIL player include a local http-server for serving a restful API. That means that you can control the player via network. That gave us four great opportunities:

  1. External applications can control player in their network.
  2. As widgets are local running websites they can use this API and pass elegantly the above-mentioned clicks or touches to the player to start specific commands, change playlist etc.
  3. You can create a web UI on a second screen, which control the presentation screen.
  4. It is possible to use a QR-Code or EAN-Code scanner to control the presentation.
<excl repeatCount="indefinite">
	<priorityClass >
		<img begin="notify(play0001)" src="0001.jpg" dur="10s"/>
		<img begin="notify(play0002)" src="0002.jpg" fit="fill" dur="10s" />
 	</priorityClass>
 	<priorityClass higher="pause">
		<img src="image.jpg" dur="indefinite" />
 	</priorityClass>
</excl>
Sending the string "play0001" via API triggers 0001.jpg and "play0002" starts displaying 0002.jpg immediately for 10s

Additional Clock Times

In every trigger, you can also set an additional clock time value. Let's take the last network trigger as base for the example.

<excl repeatCount="indefinite">
	<priorityClass >
		<img begin="notify(play0001)+2s" src="0001.jpg" dur="10s"/>
		<img begin="notify(play0002)+5s" src="0002.jpg" fit="fill" dur="10s" />
 	</priorityClass>
 	<priorityClass higher="pause">
		<img src="image.jpg" dur="indefinite" />
 	</priorityClass>
</excl>
0001.jpg starts 2s after and 0002.jpg 5s after the corresponding trigger fire

SMIL supports positive and negative values. Garlic-player currently supports only positive values.