Namespace vorple.media
Audio and video functions.
- Defined in: vorple.media.js
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Field Attributes | Field Name and Description |
|---|---|
| <static> |
vorple.media.defaults
Default options for the media player
|
Method Summary
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
vorple.media.image(file, options)
Creates an img tag.
|
| <static> |
vorple.media.isMuted(types)
Check whether a media type is muted and return the current status.
|
| <static> |
vorple.media.mute(types, options)
Mutes or unmutes all given types of media.
|
| <static> |
vorple.media.muteAll(state)
Mutes or unmutes all media types.
|
| <static> |
vorple.media.playMusic(files, options)
Play an audio file.
|
| <static> |
vorple.media.playSound(files, options)
Play an audio file.
|
| <static> |
vorple.media.preloadImage(files, options)
Preload image files.
|
| <static> |
vorple.media.stopAll()
Stop all music and sound effects.
|
| <static> |
vorple.media.stopMusic()
Stop the current music.
|
| <static> |
vorple.media.stopSounds()
Stop all currently playing sound effects.
|
| <static> |
vorple.media.toggleMute(types)
Toggle mute status of given media types.
|
| <static> |
vorple.media.youtube(id, options)
YouTube video embedding.
|
Namespace Detail
vorple.media
Field Detail
<static>
vorple.media.defaults
Default options for the media player
Method Detail
-
<static> {String} vorple.media.image(file, options)Creates an img tag.
vorple.media.image( 'foo.jpg', { class: 'bar' } ) == <img src="media/image/foo.jpg" class="bar">- Parameters:
- {String} file
- The filename of the image. If no path is specified, vorple.media.defaults.imagePath will be used.
- {Object} options Optional
- Additional attributes added to the image.
- Returns:
- {String} The HTML code for the img tag.
-
<static> {boolean|boolean[]} vorple.media.isMuted(types)Check whether a media type is muted and return the current status.
- Parameters:
- {string|string[]} types
- The audio type (music, sound, or all) as a single string or an array.
- Returns:
- {boolean|boolean[]} true if media type is muted, false otherwise. An array of truth values is returned if the parameter was given as an array.
-
<static> vorple.media.mute(types, options)Mutes or unmutes all given types of media. Muting affects also future instances of the given media. Note that muting doesn't stop loading the media files, they are just played without sound.
Mute music and unmute sound: vorple.media.mute({ music: true, sound: false });- Parameters:
- {Object} types
- The types of media to affect and the mute status of those objects as boolean (true: mute, false: unmute).
- {Object} options
- Options if default containers must be overridden.
-
<static> {Boolean} vorple.media.muteAll(state)Mutes or unmutes all media types.
- Parameters:
- {Boolean} state
- True to mute or false to unmute all.
- Returns:
- {Boolean} The new state of global mute (true: all muted, false: all unmuted).
-
<static> {Object} vorple.media.playMusic(files, options)Play an audio file.
- Parameters:
- {Object} files
- The list of different versions of the sound to be played. See the manual for further explanation.
- {Object} options Optional
- See vorple.media.playAudio
- Returns:
- {Object} A jPlayer element.
- See:
- vorple.media.playAudio
- http://jplayer.org/latest/developer-guide/
-
<static> vorple.media.playSound(files, options)Play an audio file.
- Parameters:
- {Object} files
- The list of different versions of the sound to be played. See the manual for further explanation.
- {Object} options Optional
- Any jPlayer constructor options are allowed. The default option set is
{ playerSolution 'html, flash', preload: 'auto', swfPath: 'lib', volume: 0.8 }. The "supplied" argument is automatically decided from the supplied files. The "muted" argument defaults to "false", but if Undum is restoring a saved story or the global mute switch is on, "muted" is forced to "true".
- Returns:
- A jPlayer element.
- See:
- http://jplayer.org/latest/developer-guide/
-
<static> {Image|Image[]} vorple.media.preloadImage(files, options)Preload image files.
- Parameters:
- {String|Array} files
- Filename of the image to load, or an array of files to load.
- {Object} options Optional
name type default description imagePath string 'media/image' The default path for the images.
- Returns:
- {Image|Image[]} The Image object of the preloaded images, or an array of Image objects if multiple image files were given.
-
<static> vorple.media.stopAll()Stop all music and sound effects.
-
<static> vorple.media.stopMusic()Stop the current music.
-
<static> vorple.media.stopSounds()Stop all currently playing sound effects.
-
<static> vorple.media.toggleMute(types)Toggle mute status of given media types.
- Parameters:
- {String|Array} types
- The media type to toggle, or an array of media types to toggle.
- Returns:
- If a string was given as the parameter, the new mute status is returned as a boolean (true: muted, false: unmuted). If an array is given, an array is returned with the corresponding mute statuses.
-
<static> {String} vorple.media.youtube(id, options)YouTube video embedding.
- Parameters:
- {string} id
- The id of the video to embed (the xxx part of youtube.com/watch?v=xxx)
- {object} options Optional
Any HTML attributes are allowed and they're applied to the generated <object> tag.height Height of the player width Width of the player parameters YouTube player parameters (see http://code.google.com/apis/youtube/player_parameters.html)
- Returns:
- {String} Embedding HTML code
- See:
- http://code.google.com/apis/youtube/player_parameters.html for available parameters.