Show:

I am the HypervideoModel which stores all data which make up the hypervideo.

Methods

exportIt

()

YET TO IMPLEMENT

Data exporting can be achieved in various ways.

getAnnotations

() private

When the {{#crossLinks "HypervideoModel/annotations:attribute"}}attribute annotations{{/crossLinks}} is accessed, it needs to return an array of the currently selected annotation set (choosen by assigning the annotation's ownerId to {{#crossLinks "HypervideoModel/annotationSet:attribute"}}annotationSet{{/crossLinks}}). The array needs to be sorted by the start time.

Returns:

Array of Annotations

getAnnotationSets

() Id: ownerId, name: ownerName private

Needed for the {{#crossLinks "HypervideoModel/annotationSets:attribute"}}annotationSets attribute{{/crossLinks}}. This attribute' purpose is to tell, what users have an annotationfile for the current hypervideo.

I return an array of maps in the format

[ { id: ownerid, name: ownerName }, ... ]

Returns:

Id: ownerId, name: ownerName:

Array of

getSubtitles

() private

When the {{#crossLinks "HypervideoModel/subtitles:attribute"}}attribute subtitles{{/crossLinks}} is accessed, it needs to return an array of the currently selected language subtitles (choosen by assigning the selected language to {{#crossLinks "HypervideoModel/selectedLang:attribute"}}selectedLang{{/crossLinks}}).

Returns:

Object containing the language label and an Array of Subtitles

initModel

(
  • callback
)

The data model is initialized after the Database is ready and before the different views (like ViewVideo) are created.

I do the following jobs:

Parameters:

initModelOfAnnotations

(
  • database
)
private

I create the Annotation objects from the data in the Database and store them in my videolinks attribute.

Also I select the the main annotation set (from the user who created the hypervideo) as the current one.

Parameters:

initModelOfOverlays

(
  • database
)
private

I create the Overlay objects from the data in the Database and store them in my overlays attribute.

Parameters:

initModelOfSubtitles

(
  • database
)

I create the Subtitle objects from the data in the Database and store them in my subtitles attribute.

Parameters:

leaveEditMode

(
  • logoutAfterLeaving
)

The global state "editMode" can be set to false, to trigger all modules to leave their edit mode.

However, this global state should only be altered by me, because I check first if there were any unsaved changes, and offer the user the possibility to save them.

Parameters:

newAnnotation

(
  • protoData
)

I create a new annotation.

I am called from AnnotationsController.

Parameters:

Returns:

Annotation

newOverlay

(
  • protoData
)

I create a new overlay.

I am called from OverlaysController.

Parameters:

Returns:

Overlay

newUnsavedChange

(
  • category
)

I serve the purpose to set markers (both visually and in my data model), in which categories (overlays, videolinks, annotations) the user has unsaved changes.

Parameters:

removeAnnotation

(
  • annotation
)

I remove all data of an annotation from the model and from the database.

I am called from AnnotationsController/deleteAnnotation.

Parameters:

removeOverlay

(
  • overlay
)

I remove all data of an overlay from the model and from the database.

I am called from OverlaysController/deleteOverlay.

Parameters:

save

(
  • callback
  • callbackCancel
)

I am the central function for saving changes back to the server.

I save only, what is necessary (overlays, videolinks, annotations).

When all saving requests to the server have completed, I check all their responses. If there where any errors I display them and abort. Otherwise I reset the "unsavedChanges"-markers back to false and the global state (FrameTrail.changeState('unsavedChanges', false)) and call the callback.

Note: The second parameter is optional and should not be needed because the user should already be logged in at this point (cancelCallback means, the user canceled the login).

Parameters:

selectAnnotationSet

(
  • anID
)
private

I am needed by the {{#crossLinks "HypervideoModel/annotationSet:attribute"}}annotationSet attribute{{/crossLinks}}.

My parameter can be set in three ways:

  • when the argument is null, I select the main annotation file (from the hypervideo's _index.json entry)
  • when the special string '#myAnnotationSet' is given as argument, I select the logged-in user's ID
  • an all other cases, I take the literal string as the ID to select.

When my user changes the currently selected annotation sets, I have to assure, that both myself and the {{#crossLinks "Database"}}Database{{/crossLinks}} have under the respective attribute name an [Array] present, for manipulating annotation objects inside them.

Parameters:

  • anID String or null

Returns:

String

updateHypervideo

(
  • newHypervideoID
  • restartEditMode
  • update
)

Reset & Update Hypervideo Data during runtime

Parameters:

Attributes

annotationAllSets

Object of Array of Annotation

All annotations sets of the hypervideo in a map of userIDs to their respective annotation set.

annotations

Array of Annotation readonly

The currently selected annotations of the hypervideo (fetched via {{#crossLink "HypervideoModel/getAnnotations:method"}}getAnnotations(){{/crossLinks}}).

annotationSet

Array of Annotation

The currently selected userID, to decide which annotations should be displayed (setting this attribute is done via {{#crossLink "HypervideoModel/selectAnnotationSet:method"}}selectAnnotationSet(){{/crossLinks}}).

annotationSets

Array of id: String, name: String readonly

The annotation sets of the hypervideo (fetched via {{#crossLink "HypervideoModel/getAnnotationSets:method"}}getAnnotationSets(){{/crossLinks}}).

created

Number readonly

The hypervideo's creation date

creator

String readonly

The hypervideo's creator name

creatorId

String readonly

The ID of the hypervideo's creator

description

String

Get or set the hypervideo descritption

duration

The hypervideo's duration.

This attribute must not be changed after the init process. It is either set to the duration of the "null video" ({{#crossLink "HypervideoModel/initModel:method"}}HypervideoModel/initModel(){{/crossLinks}}) or or after the video source file's meta data has loaded ({{#crossLink "HypervideoController/initController:method"}}HypervideoController/initController(){{/crossLinks}}).

hasHTML5Video

Boolean readonly

Wether the current hypervideo has a playable html5 video source file, or (otherwise) only has a duration (then we are in "Null Player" mode).

hidden

Boolean readonly

Whether the hypervideo is hidden in overview mode.

hypervideoName

String

Get or set the hypervideo name

lang

String

Get or set the subtitle language

lastchanged

Number readonly

The hypervideo's date of latest change

overlays

Array of Overlay readonly

The overlays of the hypervideo

sourceFiles

readonly

I contain a map to the .mp4 and .webm source's filenames.

subtitleFiles

Get or set the Array of subtitle files (if defined)

subtitles

readonly

The Array of subtitles (fetched via {{#crossLink "HypervideoModel/getSubtitles:method"}}getSubtitles(){{/crossLinks}}).