Skip to content

Commit 7e7cb4b

Browse files
committed
added support for 'cards.embed' lib and first draft for player integration
1 parent 3faf304 commit 7e7cb4b

File tree

3 files changed

+82
-1
lines changed

3 files changed

+82
-1
lines changed

www/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ <h2><i class="material-icons md-txt">people</i>&nbsp;<script>SepiaFW.local.w('ac
438438
<script src="scripts/sepiaFW.ui.myView.js"></script>
439439
<script src="scripts/sepiaFW.ui.events.js"></script>
440440
<script src="scripts/sepiaFW.ui.actions.js"></script>
441+
<script src="scripts/sepiaFW.ui.cards.embed.js"></script>
441442
<script src="scripts/sepiaFW.ui.cards.js"></script>
442443
<script src="scripts/sepiaFW.ui.plot.js"></script>
443444
<script src="scripts/sepiaFW.ui.customButtons.js"></script>
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
//CARDS
2+
function sepiaFW_build_ui_cards_embed(){
3+
var Embed = {};
4+
5+
//TODO: add MediaPlayer
6+
/*
7+
- Controls: start, pause/stop, resume, next, previous
8+
- State functions: getState, isOnHold
9+
- Broadcast state change (start, pause, hold, resume, ?)
10+
- Make sure only one is active
11+
- Implement async. callback with msgId and timeout
12+
*/
13+
14+
var activeMediaPlayers = {};
15+
16+
function getNewMediaPlayerId(){
17+
mediaPlayerLastId++;
18+
var overflow = false;
19+
if (mediaPlayerLastId >= 20){
20+
mediaPlayerLastId = 1;
21+
overflow = true;
22+
}
23+
var newId = ("sepia-embedded-player-" + mediaPlayerLastId);
24+
if (overflow){
25+
//TODO: remove old players
26+
//activeMediaPlayers ...
27+
}
28+
return newId;
29+
}
30+
var mediaPlayerLastId = 0;
31+
32+
Embed.MediaPlayer = function(options){
33+
if (!options) options = {};
34+
var thisPlayer = this;
35+
36+
//ID
37+
var playerId = getNewMediaPlayerId();
38+
thisPlayer.getId = function(){
39+
return playerId;
40+
}
41+
42+
//States
43+
44+
45+
//Controls - TODO: implement
46+
thisPlayer.start = function(doneCallback, errorCallback){
47+
48+
}
49+
thisPlayer.pause = function(doneCallback, errorCallback){
50+
51+
}
52+
thisPlayer.fadeOut = function(doneCallback, errorCallback){
53+
54+
}
55+
thisPlayer.resume = function(doneCallback, errorCallback){
56+
57+
}
58+
thisPlayer.fadeIn = function(doneCallback, errorCallback){
59+
60+
}
61+
thisPlayer.next = function(doneCallback, errorCallback){
62+
63+
}
64+
thisPlayer.previous = function(doneCallback, errorCallback){
65+
66+
}
67+
//stop, release resources and remove handle
68+
thisPlayer.release = function(doneCallback, errorCallback){
69+
70+
}
71+
72+
//store in list
73+
activeMediaPlayers[playerId] = thisPlayer;
74+
}
75+
76+
return Embed;
77+
}

www/scripts/sepiaFW.ui.cards.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
//ACTIONS
1+
//CARDS
22
function sepiaFW_build_ui_cards(){
33
var Cards = {};
4+
5+
//load child libs
6+
Cards.embed = sepiaFW_build_ui_cards_embed();
47

58
//card collection types
69
var UNI_LIST = "uni_list";

0 commit comments

Comments
 (0)