Conditional ending

From SpinetiX Support Wiki

Jump to: navigation, search

Introduction

Conditional ending refers to controlling / forcing the end-event of the document or a certain element within the document, based on the end-event of another element present within the document. For this, you can either use jSignage functions (.endEvent, .endsWith) or the endsync SVG attribute.

.endEvent function

The handler included by the .endEvent() function is called when the layer ends (note that it must not repeat indefinitely, otherwise it will not end). Within this handler function you can:

  • End another layer:
$('#my_media').endEvent( function(){
    $('#my_animation').end(); // end my_animation layer
});
  • Or end the entire document:
$('#my_media').endEvent( function(){
    $('svg').attr('dur', $.getCurrentTime() || 0.001 ); // end the document
});
Note Note:
This is useful especially when having documents with indefinite duration that should end when a child layer (e.g., a video) ends.

.endsWith function

The .endsWith() function allows for ending a layer (e.g., an indefinite parent layer) when another layer (e.g., a certain child layer) is ending. For example:

endsync attribute

The endsync attribute is the SVG alternative to the jSignage solutions above.

For instance, you can end a document when an inner video layer ends, by specifying the endsync attribute under the svg element:

<svg [...] dur="unresolved" endsync="my_media" [...] >
This page was last modified on 23 March 2018, at 18:00.