Constructor
new JClicPlayer($topDiv, optionsopt)
JClicPlayer constructor
Name | Type | Attributes | Description |
---|---|---|---|
$topDiv | external:jQuery | The HTML | |
options | object | <optional> | A set of optional customized options. |
- Source
Extends
Members
$div :external:jQuery
The JQuery "div" element used by this player as stage for activities
- Source
$mainContainer :external:jQuery
The main container of all JClic components
- Source
$topDiv :external:jQuery
The JQuery top container where this player will deploy
- Source
actPanel :module:Activity.Activity#Panel
The ActivityPanel
currently running on this player.
- module:Activity.
Activity#Panel
- Source
actions :Array.<module:AWT.Action>
Collection of module:AWT.Action
objects used by this player.
- Array.<module:AWT.Action>
- Source
activeMediaBag :module:media/ActiveMediaBag.ActiveMediaBag
Object containing references to realized media objects, ready to play.
- Source
audioEnabled :boolean
Whether the player must play all sounds (including system sounds) and other media content
of the activities.
- boolean
- Source
basePath :string
Relative path or absolute URL to be used as a base to access files
- string
- Source
bgImageOrigin :module:AWT.Point
Point indicating the upper-left corner of the current background image
- Source
counterVal :module:JClicPlayer.JClicPlayer~counterValType
Current values of the counters
- module:JClicPlayer.
JClicPlayer~counterValType
- Source
defaultSkin :module:skins/Skin.Skin
The default Skin to be used if none specified
- Source
defaultSkin :module:skins/Skin.Skin
The last skin directly specified by a JClicProject
- Source
delayedAction :module:AWT.Action
This variable holds the action to be executed by delayedTimer
- Source
delayedTimer :module:AWT.Timer
Timer for delayed actions
- Source
dim :module:AWT.Dimension
The Dimension
of the Rectangle
- Overrides
fullScreenChecked :boolean
Flag indicatig that this player has switched to full screen at least once
- boolean
- Source
history :module:PlayerHistory.PlayerHistory
This object records the list of the activities played during the current session.
- Source
id :string
Unique ID of this player, randomly generated by the constructor
- string
- Source
invalidatedRect :module:AWT.Rectangle
The currently "invalidated" area
- Overrides
localFS :boolean
This flag indicates if the player is running inside a document loaded by file:
protocol
- boolean
- Source
navButtonsAlways :boolean
When this flag is true
, the navigation buttons are always enabled despite
of the indications made by the activities or the sequence control system.
This is used only to debug projects with complicated sequence chaining.
- boolean
- Source
navButtonsDisabled :boolean
Whether the navigation buttons next
and back
are enabled o disabled.
- boolean
- Source
options :object
Object with miscellaneous options.
- object
- Source
pos :module:AWT.Point
The current position of the shape
- Overrides
project :module:project/JClicProject.JClicProject
The JClicProject
currently hosted in this player
- Source
reporter :module:report/Reporter.Reporter
Object responsible for passing the scores obtained by users to a external reporting systems
when playing activities.
- Source
skin :module:skins/Skin.Skin
The Skin currently used by this player.
- Source
timer :module:AWT.Timer
Main timer object used to feed the time counter. Ticks every second.
- Source
type :string
Shape type id
- string
- Overrides
zip :external:JSZip
A external:JSZip
object pointing to a jclic.zip
or jclic.scorm.zip
file containing
the current project.
Two extra properties will be added to this object when loaded:
- zip.fullZipPath {string} - The full path of the ZIP file
- zip.zipBasePath {string} - The path to the folder containing the ZIP file
- Source
Methods
activityFinished(_completedOK)
Called from Activity
when finished.
Name | Type | Description |
---|---|---|
_completedOK | boolean |
|
- Source
activityReady()
Called by module:JClicPlayer.JClicPlayer#load
when the ActivityPanel
is fully visible, just
after the JQuery animation effect.
- Source
add(shape) → {module:AWT.Rectangle}
Adds the boundaries of another shape to the current one
Name | Type | Description |
---|---|---|
shape | module:AWT. | The |
- Overrides
- Type:
- module:AWT.
Rectangle
buildActions()
Builds the module:AWT.Action
objects for this player
- Source
clip(ctx, fillRuleopt) → {external:CanvasRenderingContext2D}
Creates a clipping region on the specified HTML canvas 2D rendering context
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
ctx | external:CanvasRenderingContext2D | The rendering context | ||
fillRule | string | <optional> | 'nonzero' | Can be 'nonzero' (default when not set) or 'evenodd' |
- Overrides
- The provided rendering context
clone() → {module:AWT.Rectangle}
Clones this Rectangle
- Overrides
- Type:
- module:AWT.
Rectangle
closeHelpWindow()
Closes the help dialog window
- Source
contains(_p) → {boolean}
Checks if the provided module:AWT.Point
is inside this shape.
Name | Type | Description |
---|---|---|
_p | module:AWT. | The point to check |
- Overrides
- Type:
- boolean
displayURL(url, inFrame)
Navigates to the requested URL
Name | Type | Description |
---|---|---|
url | string | The URL to navigate to |
inFrame | boolean | When |
- Source
doLayout()
Configures the layout and visual aspect of the player area.
- Source
end() → {external:Promise}
Executes miscellaneous finalization routines.
- Source
- A promise to be fullfilled when all pending tasks are finished.
- Type:
- external:Promise
equals(r) → {boolean}
Checks if two shapes are equivalent.
Name | Type | Description |
---|---|---|
r | module:AWT. | The Shape to compare against |
- Overrides
- Type:
- boolean
exit(url)
Only when exitUrl
has been specified in options
, navigates to the specified URL
Name | Type | Description |
---|---|---|
url | string | The URL to navigate to. |
- Source
fill(ctx, dirtyRegionopt) → {external:CanvasRenderingContext2D}
Fills the Shape with the current style in the provided HTML canvas context
Name | Type | Attributes | Description |
---|---|---|---|
ctx | external:CanvasRenderingContext2D | The canvas 2D rendering context where to fill this shape. | |
dirtyRegion | module:AWT. | <optional> | The context region to be updated. Used as clipping |
- Overrides
- The provided rendering context
forceFinishActivity()
Forces the current activity to stop playing.
- Source
getActiveMediaPlayer(mediaContent) → {module:media/ActiveMediaPlayer.ActiveMediaPlayer}
Builds an ActiveMediaPlayer
for the specified module:media/MediaContent.MediaContent
Name | Type | Description |
---|---|---|
mediaContent | module:media/MediaContent. | The media content to be played |
- Source
getAttributes() → {object}
Gets a object with the basic attributes needed to rebuild this instance excluding functions,
parent references, constants and also attributes retaining the default value.
The resulting object is commonly usued to serialize elements in JSON format.
- Overrides
- The resulting object, with minimal attrributes
- Type:
- object
getBounds() → {module:AWT.Rectangle}
Gets the enclosing Rectangle
of this Shape.
- Overrides
- Type:
- module:AWT.
Rectangle
getCoords() → {string}
Gets a string with the co-ordinates of the upper-left and lower-right vertexs of this rectangle,
(with values rounded to int)
- Overrides
- Type:
- string
getCounterValue(counter) → {number}
Gets the current value for the specified counter
Name | Type | Description |
---|---|---|
counter | string | The id of the counter ('score', 'actions' or 'time') |
- Source
- Type:
- number
getOppositeVertex() → {module:AWT.Point}
Gets the module:AWT.Point
corresponding to the lower-right vertex of the Rectangle.
- Type:
- module:AWT.
Point
getShape(rect) → {module:AWT.Shape}
Gets a clone of this shape moved to the pos
component of the rectangle and scaled
by its dim
value.
Name | Type | Description |
---|---|---|
rect | module:AWT. | The rectangle to be taken as a base for moving and scaling |
- Overrides
- Type:
- module:AWT.
Shape
getUniqueId(lb) → {string}
Generates an unique ID for elements being used with this player
Name | Type | Description |
---|---|---|
lb | string | The element's label |
- Source
- Type:
- string
grow(dx, dy) → {module:AWT.Rectangle}
Expands the boundaries of this shape. This affects the current position and dimension.
Name | Type | Description |
---|---|---|
dx | number | The amount to grow (or decrease) in horizontal direction |
dy | number | The amount to grow (or decrease) in vertical direction |
- Overrides
- Type:
- module:AWT.
Rectangle
incCounterValue(counter)
Increments by 1 the value of the specified counter
Name | Type | Description |
---|---|---|
counter | string | The id of the counter ('score', 'actions' or 'time') |
- Source
incProgress(valopt)
Increments the progress bar value by the specified amount, only when the progress bar is running.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
val | number | <optional> | 1 | The amount to increment. When not defined, it's 1. |
- Source
initActivity()
Initializes the activity
- Source
initReporter() → {external:Promise}
Creates and initializes the Reporter
member
- Source
- Type:
- external:Promise
initTimers()
Creates and initializes objects of type module:AWT.Timer
- Source
intersects(_r) → {boolean}
Checks if the provided Rectangle
r
intersects with this shape.
Name | Type | Description |
---|---|---|
_r | module:AWT. |
- Overrides
- Type:
- boolean
invalidate(rect)
Adds the provided rectangle to the invalidated area.
Name | Type | Description |
---|---|---|
rect | module:AWT. |
- Overrides
isRect() → {boolean}
Shorthand method for determining if a Shape is an Rectangle
- Overrides
- Type:
- boolean
listenTouchEvents()
Detects swipe-right, swipe-left and double touch gestures on touch devices,
associating them with 'next activity', 'previous activity' and 'toggle full screen' actions
- Source
load(projectopt, sequenceopt, activityopt)
Loads the specified project and starts playing at the specified activity or sequence tag.
Name | Type | Attributes | Description |
---|---|---|---|
project | string | | <optional> | The project to load (if it's a string) or to use (if it's an object of type
|
sequence | string | | <optional> | Sequence tag or numeric order in the |
activity | string | <optional> | Name of the activity to be loaded (usually |
- Source
moveBy(delta) → {module:AWT.Shape}
Shifts the shape a specified amount in horizontal and vertical directions
Name | Type | Description |
---|---|---|
delta | Point | | The amount to shift the Shape |
- Overrides
- Type:
- module:AWT.
Shape
moveTo(newPos) → {module:AWT.Shape}
Moves this shape to a new position
Name | Type | Description |
---|---|---|
newPos | module:AWT. | The new position of the shape |
- Overrides
- Type:
- module:AWT.
Shape
playMedia(mediaContent, mediaPlacementopt, delayedActionsopt)
Plays the specified media.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
mediaContent | module:media/MediaContent. | The media to be played | ||
mediaPlacement | module:boxes/ActiveBox. | <optional> | null | The cell where the graphic component of this media should be placed (used with video objects) |
delayedActions | Array.<function()> | <optional> | null | If set, store the the action in this array for future execution |
- Source
playMsg()
Launches the active media content associated to the main message, if any.
- Source
preparePath(ctx) → {external:CanvasRenderingContext2D}
Prepares an HTML canvas 2D rendering context with a path that can be used to stroke a line,
to fill a surface or to define a clipping region.
Name | Type | Description |
---|---|---|
ctx | external:CanvasRenderingContext2D |
- Overrides
- The provided rendering context
removeActivity()
Removes the current ActivityPanel
from this player
- Source
reportEndActivity(act, solved)
Notifies the reporting system that the current activity has finished
Name | Type | Description |
---|---|---|
act | module:Activity. | The activity that is sending the notification |
solved | boolean | Whether the activity was successfully completed or not. |
- Source
reportNewAction(act, type, source, dest, ok, currentScore)
Notifies the reporting system that a new action has been performed on the current activity
Name | Type | Description |
---|---|---|
act | module:Activity. | The activity that is sending the notification |
type | string | Type of action (match, move, switch...) |
source | string | Object acting as a source of the action (cell, grid, clue...) |
dest | string | When applicable, object acting as a receiver of the action (cell, grid...) |
ok | boolean | Whether the action was OK or not |
currentScore | number | The current score of the activity |
- Source
reportNewActivity(act)
Notifies the reporting system that a new activity has started
Name | Type | Description |
---|---|---|
act | module:Activity. | The activity that is sending the notification |
- Source
reset()
Resets the main components of this player
- Source
runCmd(cmd)
Launches the specified system command.
Currently not implemented.
Name | Type | Description |
---|---|---|
cmd | string |
- Source
scaleBy(delta) → {module:AWT.Rectangle}
Multiplies the dimension of the Shape by the specified delta
amount.
Name | Type | Description |
---|---|---|
delta | Point | | Object containing the X and Y ratio to be scaled. |
- Overrides
- Type:
- module:AWT.
Rectangle
setAttributes(data) → {module:AWT.Rectangle}
Reads the properties of this Rectangle from a data object
Name | Type | Description |
---|---|---|
data | object | The data object to be parsed |
- Overrides
- Type:
- module:AWT.
Rectangle
setBounds(rect) → {module:AWT.Rectangle}
Sets this Rectangle the position and dimension of another one
Name | Type | Description |
---|---|---|
rect | module:AWT. |
- Overrides
- Type:
- module:AWT.
Rectangle
setCountDown(counter, maxValue)
Sets the specified counter in count-down status, starting at maxValue
.
Name | Type | Description |
---|---|---|
counter | string | The id of the counter ('score', 'actions' or 'time') |
maxValue | number | The value from which to start counting down |
- Source
setCounterEnabled(counter, bEnabled)
Enables or disables a specific counter
Name | Type | Description |
---|---|---|
counter | string | The id of the counter ('score', 'actions' or 'time') |
bEnabled | boolean | When |
- Source
setCounterValue(counter, newValue)
Sets a value to the specified counter
Name | Type | Description |
---|---|---|
counter | string | The id of the counter ('score', 'actions' or 'time') |
newValue | number | The value to be set |
- Source
setMsg(abc)
Sets the current main message.
Name | Type | Description |
---|---|---|
abc | module:boxes/ActiveBoxContent. | The content of the message |
- Source
setProgress(val, maxopt)
Sets the current value of the progress bar
Name | Type | Attributes | Description |
---|---|---|---|
val | number | The current value. Should be less or equal than | |
max | number | <optional> | Optional parameter representing the maximum value. When passed, the progress bar will be displayed. |
- Source
setProject(project)
Sets the current project of this player, without starting any activity
Name | Type | Description |
---|---|---|
project | module:project/JClicProject. | The project to be set |
- Source
setSkin(newSkinopt)
Sets the current skin
Name | Type | Attributes | Description |
---|---|---|---|
newSkin | module:skins/Skin. | <optional> | The skin to use. When |
- Source
setWaitCursor(status)
Set/unset the panel in 'wait' state
Name | Type | Description |
---|---|---|
status | boolean |
- Source
setWindowTitle(docTitle)
Sets a title in a specific HTML element, if provided.
Name | Type | Description |
---|---|---|
docTitle | string |
- Source
showHelp($hlpComponent) → {boolean}
Shows the help info provided by the activity
Name | Type | Description |
---|---|---|
$hlpComponent | external:jQuery | The jQuery DOM component to be shown. |
- Source
- True when the component was successfully displayed
- Type:
- boolean
showReports()
Opens the reports dialog
- Source
startActivity()
Starts the activity. This method is usually called from text activities with previous text.
- Source
startAutoPassTimer()
Starts the automatic jump to next activity, when applicable.
- Source
stop()
Instructs the player to stop working
- Source
stopMedia(levelopt)
Stops currently playing media
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
level | number | <optional> | -1 | Sets the threshold above which all media objects with equal |
- Source
stroke(ctx) → {external:CanvasRenderingContext2D}
Draws this shape in the provided HTML canvas 2D rendering context.
Name | Type | Description |
---|---|---|
ctx | external:CanvasRenderingContext2D | The canvas 2D rendering context where to draw the shape. |
- Overrides
- The provided rendering context
toString() → {string}
Overwrites the original 'Object.toString' method with a more descriptive text
- Overrides
- Type:
- string
update()
Updates the invalidated area
- Overrides
updateContent(_dirtyRegion)
Containers should implement this method to update its graphic contents. It should
be called from module:AWT.Container#update
Name | Type | Description |
---|---|---|
_dirtyRegion | module:AWT. | Specifies the area to be updated. When |
- Overrides