|
929
|
1 |
# Integrating the Metadataplayer in an HTML page # |
|
|
2 |
|
|
|
3 |
WARNING ! |
|
947
|
4 |
This documentation refers to the latest version of Metadataplayer, available in the **default** branch in our repository |
|
929
|
5 |
http://www.iri.centrepompidou.fr/dev/hg/metadataplayer |
|
|
6 |
|
|
|
7 |
## Loading the script ## |
|
|
8 |
|
|
|
9 |
The *LdtPlayer-core.js* must be declared in the HTML header. |
|
|
10 |
|
|
|
11 |
<head> |
|
|
12 |
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> |
|
|
13 |
<title>Metadataplayer integration test</title> |
|
|
14 |
<script type="text/javascript" src="metadataplayer/LdtPlayer-core.js" type="text/javascript"></script> |
|
|
15 |
</head> |
|
|
16 |
|
|
|
17 |
## Declaration of a container HTML element ## |
|
|
18 |
|
|
|
19 |
<body> |
|
|
20 |
<div id="Metadataplayer"></div> |
|
|
21 |
|
|
|
22 |
The script for configuring and loading the Metadataplayer must be executed after this element is declared either by : |
|
|
23 |
- Adding a <*script*> element at the bottom of the page |
|
|
24 |
- Using an event such as *body.onload* |
|
|
25 |
- Using jQuery's *$(function(){})* syntax or an equivalent in your favorite framework |
|
|
26 |
|
|
|
27 |
<script type="text/javascript"> |
|
|
28 |
|
|
|
29 |
## Interface language configuration ## |
|
|
30 |
|
|
|
31 |
Language is defined ISO 639-1 (e.g., "es" pour l’Espagnol, "ja" pour le Japonais, "eu" pour le Basque). As of July 2012, only English ("en") and French ("fr") are available. |
|
|
32 |
|
|
|
33 |
IriSP.language = "fr"; |
|
|
34 |
|
|
|
35 |
## Library location configuration ## |
|
|
36 |
|
|
|
37 |
By default (as defined in *defaults.js*), librairies are loaded from either a CDN (Content Distribution Network) or from the *js/libs* directory. |
|
|
38 |
|
|
|
39 |
Configuration is done by overriding the properties of *IriSP.libFiles* |
|
|
40 |
|
|
|
41 |
To use the CDN: |
|
|
42 |
|
|
|
43 |
IriSP.libFiles.useCdn = true; |
|
|
44 |
|
|
|
45 |
To change the location of the library directory: |
|
|
46 |
|
|
|
47 |
IriSP.libFiles.defaultDir = "/path/libs"; |
|
|
48 |
|
|
|
49 |
To change individual locations or to point to files outside the default directory: |
|
|
50 |
|
|
|
51 |
IriSP.libFiles.locations.jQueryUI = "libs/jquery-ui-1.8.16.custom.min.js"; |
|
|
52 |
IriSP.libFiles.locations.jwPlayerSWF = "libs/jwplayer/player.swf"; |
|
|
53 |
|
|
960
|
54 |
## Configuration of a metadata source ## |
|
929
|
55 |
|
|
|
56 |
A metadata source is defined by its url and file type (which defines the *serializer* to use). |
|
|
57 |
|
|
|
58 |
Example: |
|
|
59 |
|
|
|
60 |
var metadataSource = { |
|
|
61 |
url: "data/mydata.json", |
|
|
62 |
type: "ldt" |
|
|
63 |
}; |
|
|
64 |
|
|
|
65 |
Metadata sources are then used to configure both the video player and the widgets. |
|
|
66 |
|
|
|
67 |
## Configuration of the video player ## |
|
|
68 |
|
|
960
|
69 |
In this version, the video player is now a widget. This section is therefore obsolete |
|
929
|
70 |
|
|
|
71 |
## User Interface Configuration ## |
|
|
72 |
|
|
960
|
73 |
The interface is configured with the following properties: |
|
929
|
74 |
|
|
960
|
75 |
- **container**: ID of the DOM element in which the metadataplayer will be instantiated. |
|
|
76 |
- **width** et **height**: width and height of the interface (*height* is optional). |
|
|
77 |
- **default\_options**: Configuration options that will be passed to all widgets. In the example below, all widgets will connect to the same metadata source. |
|
|
78 |
- **css**: The URL of the base CSS stylesheet (LdtPlayer-core.css) |
|
|
79 |
- **widgets**: A list of widgets, in the following format: [ { type: *Widget type*, option_1: *Option 1 value* } ]. For widget options, please refer to the *general architecture* document |
|
929
|
80 |
|
|
|
81 |
Exemple: |
|
|
82 |
|
|
960
|
83 |
var config = { |
|
929
|
84 |
container : "Metadataplayer", |
|
|
85 |
default_options: { |
|
|
86 |
metadata: metadataSource |
|
|
87 |
}, |
|
|
88 |
css : "metadataplayer/css/LdtPlayer-core.css", |
|
|
89 |
widgets: [ |
|
|
90 |
{ |
|
960
|
91 |
type: "AutoPlayer" |
|
|
92 |
}, |
|
|
93 |
{ |
|
929
|
94 |
type: "Slider" |
|
|
95 |
},{ |
|
|
96 |
type: "Controller", |
|
|
97 |
disable\_annotate\_btn: true |
|
|
98 |
},{ |
|
|
99 |
type: "Segments", |
|
|
100 |
annotation\_type: "Chapters" |
|
|
101 |
},{ |
|
|
102 |
type: "AnnotationsList", |
|
|
103 |
container: "AnnotationsListContainer" |
|
|
104 |
} |
|
|
105 |
] |
|
|
106 |
}; |
|
|
107 |
|
|
960
|
108 |
## Player instanciation ## |
|
929
|
109 |
|
|
960
|
110 |
The metadataplayer is instantiated by creating an object of class **IriSP.Metadataplayer**. |
|
929
|
111 |
|
|
|
112 |
Exemple: |
|
|
113 |
|
|
960
|
114 |
var myPlayer = new IriSP.Metadataplayer(config); |