|
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 |
|
|
960
|
36 |
## Configuration of a metadata source ## |
|
929
|
37 |
|
|
|
38 |
A metadata source is defined by its url and file type (which defines the *serializer* to use). |
|
|
39 |
|
|
|
40 |
Example: |
|
|
41 |
|
|
|
42 |
var metadataSource = { |
|
|
43 |
url: "data/mydata.json", |
|
|
44 |
type: "ldt" |
|
|
45 |
}; |
|
|
46 |
|
|
|
47 |
Metadata sources are then used to configure both the video player and the widgets. |
|
|
48 |
|
|
|
49 |
## Configuration of the video player ## |
|
|
50 |
|
|
960
|
51 |
In this version, the video player is now a widget. This section is therefore obsolete |
|
929
|
52 |
|
|
|
53 |
## User Interface Configuration ## |
|
|
54 |
|
|
960
|
55 |
The interface is configured with the following properties: |
|
929
|
56 |
|
|
960
|
57 |
- **container**: ID of the DOM element in which the metadataplayer will be instantiated. |
|
|
58 |
- **width** et **height**: width and height of the interface (*height* is optional). |
|
|
59 |
- **default\_options**: Configuration options that will be passed to all widgets. In the example below, all widgets will connect to the same metadata source. |
|
|
60 |
- **css**: The URL of the base CSS stylesheet (LdtPlayer-core.css) |
|
|
61 |
- **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
|
62 |
|
|
|
63 |
Exemple: |
|
|
64 |
|
|
960
|
65 |
var config = { |
|
929
|
66 |
container : "Metadataplayer", |
|
|
67 |
default_options: { |
|
|
68 |
metadata: metadataSource |
|
|
69 |
}, |
|
|
70 |
css : "metadataplayer/css/LdtPlayer-core.css", |
|
|
71 |
widgets: [ |
|
|
72 |
{ |
|
960
|
73 |
type: "AutoPlayer" |
|
|
74 |
}, |
|
|
75 |
{ |
|
929
|
76 |
type: "Slider" |
|
|
77 |
},{ |
|
|
78 |
type: "Controller", |
|
|
79 |
disable\_annotate\_btn: true |
|
|
80 |
},{ |
|
|
81 |
type: "Segments", |
|
|
82 |
annotation\_type: "Chapters" |
|
|
83 |
},{ |
|
|
84 |
type: "AnnotationsList", |
|
|
85 |
container: "AnnotationsListContainer" |
|
|
86 |
} |
|
|
87 |
] |
|
|
88 |
}; |
|
|
89 |
|
|
960
|
90 |
## Player instanciation ## |
|
929
|
91 |
|
|
960
|
92 |
The metadataplayer is instantiated by creating an object of class **IriSP.Metadataplayer**. |
|
929
|
93 |
|
|
|
94 |
Exemple: |
|
|
95 |
|
|
960
|
96 |
var myPlayer = new IriSP.Metadataplayer(config); |