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