“Image ES” – A Discrete Keyframe based Experience Provider
The previous section explained the structure of a skeleton Experience Provider which may be used as a template for writing providers of arbitrary complexity. In many cases, however, a more constrained form of Experience Provider may suffice, in particular, one where continuous rendering of the experience is not required. Instead rendering is only required at discrete points in time that correspond to the occurrence of Keyframes in the Experience Stream. For such Experiences, the SDK has an implementation of “base class”, DiscreteKeyframeESBase”, that does much of the bookkeeping required to render the Experience as it transitions through various player states and switches from one Experience Stream to another.
Image Experience Provider Sample is an example of an Experience Provider that extends DiscreteKeyframeESBase. The provider supports panning, zooming and rotation of an image, either as specified in Keyframes or under the direction of interaction controls that are registered with the player.
Note: You can see the code and execute it on our RIN REPL. Note the usage of ‘Keyframes’ in the image experience stream.
The ImageES provider object is defined in an anonymous function that takes as its argument the discrete keyframe base class implementation:
The above code registers a factory function under the name “SampleImageExperienceStream”. The function creates instances of the ImageES object. Each instance is bound to a specific Experience, which is a specific image in this case.
Refer to the sample provider source code for details of how it implements the displayKeyframe method and other methods the “base class” calls to actually render content and hook into player interaction controls.