author | ymh <ymh.work@gmail.com> |
Sat, 03 Dec 2016 02:43:57 +0100 | |
changeset 463 | 5c43f17f87b5 |
parent 462 | ebd8269781fa |
permissions | -rw-r--r-- |
209
35cb7200bb0a
Separate playlist and player component with player service as bridge
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
1 |
import Ember from 'ember'; |
35cb7200bb0a
Separate playlist and player component with player service as bridge
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
2 |
|
215
82878d132784
Play/Pause/Reset events from player/playlist-components
Chloe Laisne <chloe.laisne@gmail.com>
parents:
214
diff
changeset
|
3 |
export default Ember.Service.extend(Ember.Evented, { |
209
35cb7200bb0a
Separate playlist and player component with player service as bridge
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
4 |
|
214
9bff007eb03c
Reflect player-component actions on playlist-component
Chloe Laisne <chloe.laisne@gmail.com>
parents:
212
diff
changeset
|
5 |
items: [], |
9bff007eb03c
Reflect player-component actions on playlist-component
Chloe Laisne <chloe.laisne@gmail.com>
parents:
212
diff
changeset
|
6 |
item: null, |
242 | 7 |
model: null, |
253
0be9770b09b4
Hide/show transcript button in the player - Do not request transscript when property is null in the document request
Chloe Laisne <chloe.laisne@gmail.com>
parents:
252
diff
changeset
|
8 |
transcript: null, |
462 | 9 |
transcriptIframe: false, |
459
6a296e92887f
add a spinner when opening a transcript
ymh <ymh.work@gmail.com>
parents:
414
diff
changeset
|
10 |
transcriptLoading: false, |
463
5c43f17f87b5
add a checkbox in player to control transcript autoscroll
ymh <ymh.work@gmail.com>
parents:
462
diff
changeset
|
11 |
autoscroll: true, |
212
f2c6080a73aa
Player backward/forward design logic
Chloe Laisne <chloe.laisne@gmail.com>
parents:
209
diff
changeset
|
12 |
|
271
e234339fe8df
Fix display notice error + Hide notice/transcript/video when changing route
Chloe Laisne <chloe.laisne@gmail.com>
parents:
254
diff
changeset
|
13 |
window: false, |
242 | 14 |
playing: false, |
247
7a5d729992b8
Design and animate transcript
Chloe Laisne <chloe.laisne@gmail.com>
parents:
246
diff
changeset
|
15 |
progress: 0, // In Milliseconds |
254 | 16 |
videoscreen: false, |
17 |
||
18 |
modelObserver: Ember.observer('model', function() { |
|
19 |
this.toggleVideoscreen(this.get('model').get('video')); |
|
20 |
}), |
|
214
9bff007eb03c
Reflect player-component actions on playlist-component
Chloe Laisne <chloe.laisne@gmail.com>
parents:
212
diff
changeset
|
21 |
|
254 | 22 |
displayAdditionalInformation: function(el) { |
23 |
if(el === 'video') { |
|
24 |
this.toggleVideoscreen(); |
|
25 |
} else { |
|
338
4a3899b6a7ed
Fix notice/transcript display when adding filter from notice, switching from playlist, toolbar, and player
Chloe Laisne <chloe.laisne@gmail.com>
parents:
271
diff
changeset
|
26 |
if(this.get('window') !== el) { |
4a3899b6a7ed
Fix notice/transcript display when adding filter from notice, switching from playlist, toolbar, and player
Chloe Laisne <chloe.laisne@gmail.com>
parents:
271
diff
changeset
|
27 |
this.displayMetadata(el); |
4a3899b6a7ed
Fix notice/transcript display when adding filter from notice, switching from playlist, toolbar, and player
Chloe Laisne <chloe.laisne@gmail.com>
parents:
271
diff
changeset
|
28 |
} else { |
4a3899b6a7ed
Fix notice/transcript display when adding filter from notice, switching from playlist, toolbar, and player
Chloe Laisne <chloe.laisne@gmail.com>
parents:
271
diff
changeset
|
29 |
this.displayMetadata(false); |
4a3899b6a7ed
Fix notice/transcript display when adding filter from notice, switching from playlist, toolbar, and player
Chloe Laisne <chloe.laisne@gmail.com>
parents:
271
diff
changeset
|
30 |
} |
254 | 31 |
} |
32 |
}, |
|
33 |
||
34 |
displayMetadata: function(el) { |
|
338
4a3899b6a7ed
Fix notice/transcript display when adding filter from notice, switching from playlist, toolbar, and player
Chloe Laisne <chloe.laisne@gmail.com>
parents:
271
diff
changeset
|
35 |
if(typeof el !== 'undefined') { |
251
ac320de33ec7
Add transcript button to player-component
Chloe Laisne <chloe.laisne@gmail.com>
parents:
249
diff
changeset
|
36 |
this.set('window', el); |
459
6a296e92887f
add a spinner when opening a transcript
ymh <ymh.work@gmail.com>
parents:
414
diff
changeset
|
37 |
if(el==='transcript') { |
462 | 38 |
this.set('transcriptLoading', !this.get('transcriptIframe')); |
459
6a296e92887f
add a spinner when opening a transcript
ymh <ymh.work@gmail.com>
parents:
414
diff
changeset
|
39 |
} |
251
ac320de33ec7
Add transcript button to player-component
Chloe Laisne <chloe.laisne@gmail.com>
parents:
249
diff
changeset
|
40 |
} else { |
271
e234339fe8df
Fix display notice error + Hide notice/transcript/video when changing route
Chloe Laisne <chloe.laisne@gmail.com>
parents:
254
diff
changeset
|
41 |
this.set('window', false); |
459
6a296e92887f
add a spinner when opening a transcript
ymh <ymh.work@gmail.com>
parents:
414
diff
changeset
|
42 |
this.set('transcriptLoading', false); |
251
ac320de33ec7
Add transcript button to player-component
Chloe Laisne <chloe.laisne@gmail.com>
parents:
249
diff
changeset
|
43 |
} |
ac320de33ec7
Add transcript button to player-component
Chloe Laisne <chloe.laisne@gmail.com>
parents:
249
diff
changeset
|
44 |
}, |
ac320de33ec7
Add transcript button to player-component
Chloe Laisne <chloe.laisne@gmail.com>
parents:
249
diff
changeset
|
45 |
|
254 | 46 |
toggleVideoscreen: function(state) { |
47 |
if(typeof state === 'undefined') { |
|
48 |
this.set('videoscreen', !this.get('videoscreen')); |
|
49 |
} else { |
|
50 |
this.set('videoscreen', state); |
|
414
5c6c526a7fc1
Display for single notice, preparation for share link
ymh <ymh.work@gmail.com>
parents:
373
diff
changeset
|
51 |
} |
254 | 52 |
}, |
53 |
||
215
82878d132784
Play/Pause/Reset events from player/playlist-components
Chloe Laisne <chloe.laisne@gmail.com>
parents:
214
diff
changeset
|
54 |
init: function() { |
82878d132784
Play/Pause/Reset events from player/playlist-components
Chloe Laisne <chloe.laisne@gmail.com>
parents:
214
diff
changeset
|
55 |
this.on('reset', Ember.run.bind(this, this.get('reset'))); |
82878d132784
Play/Pause/Reset events from player/playlist-components
Chloe Laisne <chloe.laisne@gmail.com>
parents:
214
diff
changeset
|
56 |
}, |
82878d132784
Play/Pause/Reset events from player/playlist-components
Chloe Laisne <chloe.laisne@gmail.com>
parents:
214
diff
changeset
|
57 |
|
249 | 58 |
setProgress: function(time) { |
59 |
this.set('progress', time); |
|
60 |
}, |
|
61 |
||
252
ba4fd614582a
Load player with selected row
Chloe Laisne <chloe.laisne@gmail.com>
parents:
251
diff
changeset
|
62 |
select: function (id) { |
ba4fd614582a
Load player with selected row
Chloe Laisne <chloe.laisne@gmail.com>
parents:
251
diff
changeset
|
63 |
this.set('item', id); |
ba4fd614582a
Load player with selected row
Chloe Laisne <chloe.laisne@gmail.com>
parents:
251
diff
changeset
|
64 |
}, |
ba4fd614582a
Load player with selected row
Chloe Laisne <chloe.laisne@gmail.com>
parents:
251
diff
changeset
|
65 |
|
249 | 66 |
play: function(id) { |
252
ba4fd614582a
Load player with selected row
Chloe Laisne <chloe.laisne@gmail.com>
parents:
251
diff
changeset
|
67 |
this.select(id); |
249 | 68 |
this.set('playing', true); |
69 |
}, |
|
70 |
||
71 |
pause: function() { |
|
72 |
this.set('playing', false); |
|
73 |
}, |
|
74 |
||
215
82878d132784
Play/Pause/Reset events from player/playlist-components
Chloe Laisne <chloe.laisne@gmail.com>
parents:
214
diff
changeset
|
75 |
reset: function(id) { |
82878d132784
Play/Pause/Reset events from player/playlist-components
Chloe Laisne <chloe.laisne@gmail.com>
parents:
214
diff
changeset
|
76 |
this.set('item', id); |
242 | 77 |
} |
209
35cb7200bb0a
Separate playlist and player component with player service as bridge
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff
changeset
|
78 |
}); |