Theme Singleton

Several utilities for handling global styling for your application.

Theme()

Example

The below example will add 2 streams to the media entry both having a bitrate of 1000

new MAF.media.PlaylistEntry({
   bitrate: 1000,
   streams: [
      { url: 'http://my.url/video1.mp4' },
      { url: 'http://my.url/video2.mp4' }
   ]
});

Methods

Fonts.add(name, file, formats) static

Add a font to the application.

Parameters:

NameTypeArgumentDescription
nameString

Font name.

fileString

Location to the font file.

formatsArrayoptional 

Default is ['eot', 'woff', 'truetype']

Fonts.has(name) static

Check if a certain font is available for the application

Parameters:

NameTypeDescription
nameString

Font name.

Fonts.remove(name) static

Remove a certain font from the application.

Parameters:

NameTypeDescription
nameString

Font name which to remove.

alias(alias, original)

Make a alias of a existing configuration

Parameters:

NameTypeDescription
aliasString

Name of the alias

originalString

ClassName of a existing configuration.

Example

The below example will add 2 streams to the media entry both having a bitrate of 1000

new MAF.media.PlaylistEntry({
   bitrate: 1000,
   streams: [
      { url: 'http://my.url/video1.mp4' },
      { url: 'http://my.url/video2.mp4' }
   ]
});

get(name, key)

Retrieve a Theme configuration.

Parameters:

NameTypeArgumentDescription
nameString

Name of the configuration to retrieve.

keyStringoptional 

Specific subentry in the configuration to retrieve.

Example

The below example will add 2 streams to the media entry both having a bitrate of 1000

new MAF.media.PlaylistEntry({
   bitrate: 1000,
   streams: [
      { url: 'http://my.url/video1.mp4' },
      { url: 'http://my.url/video2.mp4' }
   ]
});

getStyles(controlname, state) → {Object}

Parameters:

NameTypeArgumentDefaultDescription
controlnameString

Name of the component.

stateStringoptional normal

If the control has styles configured for different states you can retrieve the configuration for a specific state only.

Returns:

Control configurations, if a state is found it only returns the styles for the specific state. If no state is found the normal styles are returned.

renderSkin(name, state, width, height, agrs)

If a renderskin method is defined in the Theme of the class, you can execute it with this method.

Parameters:

NameTypeArgumentDescription
nameString

Class skin you want to build.

stateString

State of the skin.

widthNumber

Width the skins needs to be.

heightNumber

Height the skin needs to be.

agrsObjectoptional 

Optional arguments.

set(blob)

Set a Theme configuration.

Parameters:

NameTypeDescription
blobObject

This can contain theme settings for several classes

Example

The below example will add 2 streams to the media entry both having a bitrate of 1000

new MAF.media.PlaylistEntry({
   bitrate: 1000,
   streams: [
      { url: 'http://my.url/video1.mp4' },
      { url: 'http://my.url/video2.mp4' }
   ]
});