Syntax - Youtube mediatype

The youtube media type allows you to show youtube videos within your ximpel presentation.


							    <subject id="subject1">
							            <youtube id="AI0RTvlm0hw"/>
This plays the youtube video with the id AI0RTvlm0hw. The id of a youtube video can be found by going to the video in youtube and looking at the url of the video. For instance:

or maybe something like:

The part v=AI0RTvlm0hw specifies the video that is playing, where AI0RTvlm0hw is the video ID in this case.

Positioning of the youtube video

The x, y, width and height attributes can be used to position the youtube video at a certain spot within the presentation and force it to have a certain size. If you don't set any of these attributes then the youtube video will take up the entire view area.

						<youtube id="AI0RTvlm0hw" x="200px" y="200px" width="400px" height="400" />

By setting the x and/or y attributes, the video will have an offset from the top-left of the view area. In that case if you don't specify a width or height attribute the video will will have a width and height equal to the view-area. This will cause part of the video to become invisble (because offset+view-area is bigger than the view-area). Usually you want to provide width/height attributes when using x and y offsets. By specifying the width and/or height attributes you can change the width and height that the video will have.

Note: the video itself might not have the dimensions you specified. This is because youtube will maintain the aspect ratio of the video. If you specify a width and height that does not reflect the aspect ratio of the video then youtube will use your specified width and height and display the video as large as possible inside these dimensions while maintaining the aspect ratio. In that case black bars may appear at the sides or the top/bottom of the video. If this is undesirable, then choose a width/height equal to the aspect ratio of the video.

The x, y, width and height of the youtube video are all based on a 1920x1080 resolution. So the visible area of the presentation lies between x=0 to x=1920 and y=0 to y=1080. Read more about the native XIMPEL resolution here.

Playing only part of the youtube video

In order to start playing at a certain point within the youtube video, the startTime attribute can be used. This specifies the startTime in seconds from which to start playing.
<youtube id="AI0RTvlm0hw" startTime="30" />
To control how much of the youtube video should be played, you can use the duration attribute that is available for all media types. This specifies the number of seconds to play. So if the startTime="30" and the duration="10" then the video will play from the 30 seconds point of the video to 40 seconds point of the video.
<youtube id="AI0RTvlm0hw" startTime="30" duration="10" />

Leaving out the duration attribute means it will play until the end of the video. Leaving out the startTime attribute means the video will be played from the beginning.

Mute audio

To mute the audio of a YouTube video, you can set the mute attribute to true:
<youtube id="AI0RTvlm0hw" mute="true" />