README.md 1.89 KB
Newer Older
Brice Vercoustre's avatar
Brice Vercoustre committed
1
Libcast HTML5 Player JavaScript Client
brice's avatar
brice committed
2 3 4 5
======================================

### Installation and use

brice's avatar
brice committed
6 7
The script `build/libcast_player_client.min.js` must be included either inside the `<head>` document part, 
or at the end of the HTML page, just before the closing `</body>` tag.
brice's avatar
brice committed
8

brice's avatar
brice committed
9 10 11 12
Then you must instanciate one `LibcastPlayer` object per embed:
```javascript
var player = new LibcastPlayer('player_id');
```
brice's avatar
brice committed
13

brice's avatar
brice committed
14
See `tests/single_embed.html` for a complete example of how to use this client.
brice's avatar
brice committed
15 16 17 18 19 20 21

After client instantiation, Libcast embeds should behave like the standard 
HTML5 MediaElement API (see https://developer.mozilla.org/en/docs/Web/API/HTMLMediaElement).


### Available player methods

brice's avatar
brice committed
22
The following list of methods is available from embed `<iframe>` elements 
brice's avatar
brice committed
23 24 25 26 27 28 29 30
once the Libcast client has been instantiated.

- `play()`
- `pause()`
- `toggle()` [*]
- `seek(seconds)` [*] where `seconds` must be an integer or a float
- `chapter(number)` [*] where `number` must be an integer
- `mute()` [*]
brice's avatar
brice committed
31
- `setVolume(level)` [**] where `level` must be a float between 0 and 1 (percentage)
brice's avatar
brice committed
32 33 34

(* non HTML5 MediaElement API standard)

brice's avatar
brice committed
35 36
(** a bit different from the HTML5 MediaElement API standard because of JavaScript limitations)

brice's avatar
brice committed
37 38
### Available player attributes

brice's avatar
brice committed
39
The following list of attributes is available from embed `<iframe>` elements 
brice's avatar
brice committed
40 41 42 43 44 45 46 47 48
once the Libcast client has been instantiated.

- `volume`
- `duration`
- `currentTime`


### Available player events

brice's avatar
brice committed
49
The following list of events is emitted by embed `<iframe>` elements once the 
brice's avatar
brice committed
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
Libcast client has been instantiated.

- `loadedmetadata`
- `loadeddata`
- `canplay`
- `play`
- `playing`
- `pause`
- `timeupdate`
- `volumechange`
- `ended`


### Compile source

brice's avatar
brice committed
65
1. Install npm (Node) on your machine 
brice's avatar
brice committed
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81

2. Install grunt
```
npm install -g grunt-cli
```

3. Install npm dependencies
```
npm install
```

4. Build source
```
grunt
```

brice's avatar
brice committed
82
This should compile source under the `/build` directory.