flexPartyPlayer 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. data/Gemfile +6 -0
  2. data/README +45 -0
  3. data/lib/corelib-08.30.2007.swc +0 -0
  4. data/lib/flexPartyPlayer.rb +42 -0
  5. data/lib/flexunit-08.30.2007.swc +0 -0
  6. data/sample.json +1 -0
  7. data/script/destroy +14 -0
  8. data/script/flex_compile +2 -0
  9. data/script/generate +14 -0
  10. data/src/FlexPlayer.mxml +34 -0
  11. data/src/assets/app_icons/icon_128.png +0 -0
  12. data/src/cc/varga/mvc/ApplicationContext.as +120 -0
  13. data/src/cc/varga/mvc/commands/data/LoadArtistDataCommand.as +61 -0
  14. data/src/cc/varga/mvc/commands/playlist/AddItemToPlaylist.as +13 -0
  15. data/src/cc/varga/mvc/commands/playlist/LoadPlaylistCommand.as +109 -0
  16. data/src/cc/varga/mvc/commands/system/DrawPlaylist.as +40 -0
  17. data/src/cc/varga/mvc/commands/system/Shutdown.as +51 -0
  18. data/src/cc/varga/mvc/commands/system/Startup.as +57 -0
  19. data/src/cc/varga/mvc/commands/video/AddVideoCommand.as +55 -0
  20. data/src/cc/varga/mvc/events/appBar/AppBarEvent.as +16 -0
  21. data/src/cc/varga/mvc/events/blipfm/feedloader/FeedLoaderEvent.as +17 -0
  22. data/src/cc/varga/mvc/events/controllers/ControllersEvent.as +59 -0
  23. data/src/cc/varga/mvc/events/menu/MenuEvent.as +13 -0
  24. data/src/cc/varga/mvc/events/player/PlayerEvent.as +29 -0
  25. data/src/cc/varga/mvc/events/playlist/PlaylistEvent.as +16 -0
  26. data/src/cc/varga/mvc/events/playlist/PlaylistURLEvent.as +57 -0
  27. data/src/cc/varga/mvc/events/playlist/controller/PlaylistControllerEvent.as +59 -0
  28. data/src/cc/varga/mvc/events/search/SearchEvent.as +17 -0
  29. data/src/cc/varga/mvc/events/serveradmin/ServerAdminEvent.as +15 -0
  30. data/src/cc/varga/mvc/events/sound/SoundEvent.as +16 -0
  31. data/src/cc/varga/mvc/events/system/SystemEvent.as +24 -0
  32. data/src/cc/varga/mvc/models/data/AppDataModel.as +17 -0
  33. data/src/cc/varga/mvc/models/player/PlayerModel.as +76 -0
  34. data/src/cc/varga/mvc/models/playlist/PlaylistModel.as +118 -0
  35. data/src/cc/varga/mvc/models/sound/ISound.as +12 -0
  36. data/src/cc/varga/mvc/models/sound/SoundModel.as +284 -0
  37. data/src/cc/varga/mvc/models/sound/SoundModelPlayer.as +8 -0
  38. data/src/cc/varga/mvc/services/KeyboardControl.as +60 -0
  39. data/src/cc/varga/mvc/views/blipfm/feedloader/FeedLoader.mxml +34 -0
  40. data/src/cc/varga/mvc/views/blipfm/feedloader/FeedLoaderMediator.as +68 -0
  41. data/src/cc/varga/mvc/views/controllers/Controllers.mxml +36 -0
  42. data/src/cc/varga/mvc/views/controllers/ControllersMediator.as +107 -0
  43. data/src/cc/varga/mvc/views/infoDisplay/InfoDisplay.mxml +20 -0
  44. data/src/cc/varga/mvc/views/infoDisplay/InfoDisplayMediator.as +51 -0
  45. data/src/cc/varga/mvc/views/menu/Menu.mxml +28 -0
  46. data/src/cc/varga/mvc/views/menu/MenuMediator.as +30 -0
  47. data/src/cc/varga/mvc/views/player/PlayerItem.mxml +11 -0
  48. data/src/cc/varga/mvc/views/player/PlayerWindow.mxml +73 -0
  49. data/src/cc/varga/mvc/views/player/PlayerWindowMediator.as +136 -0
  50. data/src/cc/varga/mvc/views/playlist/Playlist.mxml +22 -0
  51. data/src/cc/varga/mvc/views/playlist/PlaylistMediator.as +117 -0
  52. data/src/cc/varga/mvc/views/playlist/PlaylistStates.as +10 -0
  53. data/src/cc/varga/mvc/views/playlistItem/PlaylistItem.mxml +94 -0
  54. data/src/cc/varga/mvc/views/playlistItem/PlaylistItemMediator.as +87 -0
  55. data/src/cc/varga/mvc/views/playlistManager/PlaylistManager.mxml +7 -0
  56. data/src/cc/varga/mvc/views/playlistManager/PlaylistManagerMediator.as +15 -0
  57. data/src/cc/varga/mvc/views/playlisturl/PlaylistURL.mxml +41 -0
  58. data/src/cc/varga/mvc/views/playlisturl/PlaylistURLMediator.as +87 -0
  59. data/src/cc/varga/mvc/views/playlisturl/controller/PlaylistController.mxml +37 -0
  60. data/src/cc/varga/mvc/views/playlisturl/controller/PlaylistControllerMediator.as +79 -0
  61. data/src/cc/varga/mvc/views/search/Search.mxml +26 -0
  62. data/src/cc/varga/mvc/views/search/SearchMediator.as +31 -0
  63. data/src/cc/varga/mvc/views/server/administration/ServerAdmin.mxml +26 -0
  64. data/src/cc/varga/mvc/views/server/administration/ServerAdminMediator.as +51 -0
  65. data/src/cc/varga/mvc/views/visualisation/Visualisation.mxml +8 -0
  66. data/src/cc/varga/mvc/views/visualisation/VisualisationMediator.as +51 -0
  67. data/src/cc/varga/utils/URLHelper.as +52 -0
  68. data/src/cc/varga/utils/logging/Logger.as +94 -0
  69. data/src/com/automatastudios/audio/audiodecoder/AudioDecoder.as +84 -0
  70. data/src/com/automatastudios/audio/audiodecoder/decoders/AudioInfo.as +52 -0
  71. data/src/com/automatastudios/audio/audiodecoder/decoders/IDecoder.as +13 -0
  72. data/src/com/automatastudios/audio/audiodecoder/decoders/OggVorbisDecoder.as +221 -0
  73. data/src/com/automatastudios/audio/audiodecoder/decoders/WAVDecoder.as +325 -0
  74. data/src/com/automatastudios/audio/audiodecoder/events/AudioDecoderEvent.as +13 -0
  75. data/src/com/automatastudios/data/riff/RIFFChunkInfo.as +6 -0
  76. data/src/com/automatastudios/data/riff/RIFFParser.as +175 -0
  77. data/src/libs/appinf/appinf.json +0 -0
  78. data/src/libs/appinf/config.json +0 -0
  79. data/src/libs/appinf/sample.json +1 -0
  80. data/src/libs/appinf/server.json +0 -0
  81. data/src/nl/flexcoders/controls/YouTubePlayer.as +317 -0
  82. data/test/Test-app.xml +40 -0
  83. data/test/Test.mxml +35 -0
  84. data/views/jukebox.haml +30 -0
  85. metadata +157 -0
@@ -0,0 +1,36 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
3
+ xmlns:s="library://ns.adobe.com/flex/spark"
4
+ xmlns:mx="library://ns.adobe.com/flex/halo"
5
+ xmlns:controls="nl.flexcoders.controls.*"
6
+ width="100%" height="100%">
7
+ <fx:Script>
8
+ <![CDATA[
9
+ import cc.varga.mvc.events.controllers.ControllersEvent;
10
+ ]]>
11
+ </fx:Script>
12
+
13
+ <fx:Declarations>
14
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
15
+ </fx:Declarations>
16
+
17
+ <s:Group width="100%" height="100%" verticalCenter="0" horizontalCenter="0">
18
+ <s:layout><s:VerticalLayout/></s:layout>
19
+
20
+ <s:Group width="100%" height="350">
21
+ <controls:YouTubePlayer id="youtubePlayer" width="100%" height="350" autoPlay="true" />
22
+ </s:Group>
23
+
24
+ <s:Group width="100%">
25
+ <s:layout><s:HorizontalLayout/></s:layout>
26
+ <s:Button id="Btn_play" label="Play" height="55" click="dispatchEvent(new ControllersEvent(ControllersEvent.PLAY_CLICK))"/>
27
+ <s:Button id="Btn_stop" label="Stop" height="55" click="dispatchEvent(new ControllersEvent(ControllersEvent.STOP_CLICK))" />
28
+ <s:Button id="Btn_prev" label="Previous" height="55" click="dispatchEvent(new ControllersEvent(ControllersEvent.PREV_CLICK))"/>
29
+ <s:Button id="Btn_next" label="Next" height="55" click="dispatchEvent(new ControllersEvent(ControllersEvent.NEXT_CLICK))" />
30
+ </s:Group>
31
+
32
+ <s:Label text="Volume" height="20" fontSize="16" />
33
+ <s:HSlider id="volimeSlider" height="20" width="100%" />
34
+
35
+ </s:Group>
36
+ </s:Group>
@@ -0,0 +1,107 @@
1
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2
+ //
3
+ //Authors: Franics Varga
4
+ //eMail: fv@varga-multimedia.com
5
+ //homepage: http://www.varga-multimedia.com
6
+ //
7
+ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8
+ //<a href='http://creativecommons.org/licenses/by-nc-sa/3.0/'>Creative Commons License<a\>
9
+ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
10
+ //
11
+ //You are free:
12
+ //
13
+ //to Share — to copy, distribute and transmit the work
14
+ //to Remix — to adapt the work
15
+ //Under the following conditions:
16
+ //
17
+ //Attribution — You must attribute the work in the manner specified by the author or licensor
18
+ //(but not in any way that suggests that they endorse you or your use of the work).
19
+ //
20
+ //Noncommercial — You may not use this work for commercial purposes.
21
+ //
22
+ //Share Alike — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
23
+ //
24
+ //With the understanding that:
25
+ //
26
+ //Waiver — Any of the above conditions can be waived if you get permission from the copyright holder.
27
+ //Public Domain — Where the work or any of its elements is in the public domain under applicable law, that status is in no way affected by the license.
28
+ //Other Rights — In no way are any of the following rights affected by the license:
29
+ //
30
+ //Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations; The author's moral rights;
31
+ //
32
+ //Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights.
33
+ //Notice — For any reuse or distribution, you must make clear to others the license terms of this work.
34
+ //The best way to do this is with a link to this web page.
35
+ //
36
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
37
+ package cc.varga.mvc.views.controllers
38
+ {
39
+
40
+ import cc.varga.mvc.events.controllers.ControllersEvent;
41
+ import cc.varga.mvc.models.player.PlayerModel;
42
+ import cc.varga.mvc.models.playlist.*;
43
+ import cc.varga.mvc.models.sound.SoundModel;
44
+ import cc.varga.utils.logging.Logger;
45
+
46
+ import mx.controls.Alert;
47
+
48
+ import org.robotlegs.mvcs.Mediator;
49
+
50
+ public class ControllersMediator extends Mediator
51
+ {
52
+
53
+ [Inject]
54
+ public var view : Controllers;
55
+
56
+ [Inject]
57
+ public var model : SoundModel;
58
+
59
+ [Inject]
60
+ public var playlistModel : PlaylistModel;
61
+
62
+ [Inject]
63
+ public var listModel : PlayerModel;
64
+
65
+ public function ControllersMediator()
66
+ {
67
+ super();
68
+ }
69
+
70
+ override public function onRegister() : void{
71
+
72
+ Logger.tracing("ControllersMediator onRegister", this.toString());
73
+
74
+ eventMap.mapListener(view, ControllersEvent.NEXT_CLICK, nextClicked);
75
+ eventMap.mapListener(view, ControllersEvent.PLAY_CLICK, playClicked);
76
+ eventMap.mapListener(view, ControllersEvent.PREV_CLICK, prevClicked);
77
+ eventMap.mapListener(view, ControllersEvent.STOP_CLICK, stopClicked);
78
+
79
+ }
80
+
81
+ private function stopClicked(event : ControllersEvent):void{
82
+
83
+ Logger.tracing("stop sound", this.toString());
84
+ model.stop();
85
+
86
+ }
87
+
88
+ private function prevClicked(event : ControllersEvent):void{
89
+ model.prev();
90
+ }
91
+
92
+ private function playClicked(event : ControllersEvent):void{
93
+
94
+ Logger.tracing("Play Playlist", this.toString());
95
+
96
+ model.playPlaylist( listModel );
97
+
98
+ }
99
+
100
+ private function nextClicked(event : ControllersEvent):void{
101
+ model.next();
102
+ }
103
+
104
+ public function toString():String{ return "cc.varga.mvc.views.controllers.ControllersMediator"}
105
+ }
106
+
107
+ }
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
3
+ xmlns:s="library://ns.adobe.com/flex/spark"
4
+ xmlns:mx="library://ns.adobe.com/flex/halo"
5
+ creationComplete="group1_creationCompleteHandler(event)">
6
+ <fx:Script>
7
+ <![CDATA[
8
+ import mx.events.FlexEvent;
9
+
10
+ protected function group1_creationCompleteHandler(event:FlexEvent):void
11
+ {
12
+ // TODO Auto-generated method stub
13
+ }
14
+
15
+ ]]>
16
+ </fx:Script>
17
+ <fx:Declarations>
18
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
19
+ </fx:Declarations>
20
+ </s:Group>
@@ -0,0 +1,51 @@
1
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2
+ //
3
+ //Authors: Franics Varga
4
+ //eMail: fv@varga-multimedia.com
5
+ //homepage: http://www.varga-multimedia.com
6
+ //
7
+ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8
+ //<a href='http://creativecommons.org/licenses/by-nc-sa/3.0/'>Creative Commons License<a\>
9
+ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
10
+ //
11
+ //You are free:
12
+ //
13
+ //to Share — to copy, distribute and transmit the work
14
+ //to Remix — to adapt the work
15
+ //Under the following conditions:
16
+ //
17
+ //Attribution — You must attribute the work in the manner specified by the author or licensor
18
+ //(but not in any way that suggests that they endorse you or your use of the work).
19
+ //
20
+ //Noncommercial — You may not use this work for commercial purposes.
21
+ //
22
+ //Share Alike — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
23
+ //
24
+ //With the understanding that:
25
+ //
26
+ //Waiver — Any of the above conditions can be waived if you get permission from the copyright holder.
27
+ //Public Domain — Where the work or any of its elements is in the public domain under applicable law, that status is in no way affected by the license.
28
+ //Other Rights — In no way are any of the following rights affected by the license:
29
+ //
30
+ //Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations; The author's moral rights;
31
+ //
32
+ //Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights.
33
+ //Notice — For any reuse or distribution, you must make clear to others the license terms of this work.
34
+ //The best way to do this is with a link to this web page.
35
+ //
36
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
37
+ package cc.varga.mvc.views.infoDisplay
38
+ {
39
+ import org.robotlegs.mvcs.Mediator;
40
+
41
+ public class InfoDisplayMediator extends Mediator
42
+ {
43
+ public function InfoDisplayMediator()
44
+ {
45
+ super();
46
+ }
47
+
48
+ public function toString():String{ return "cc.varga.mvc.views.infoDisplay.InfoDisplayMediator"}
49
+ }
50
+
51
+ }
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
3
+ xmlns:s="library://ns.adobe.com/flex/spark"
4
+ xmlns:mx="library://ns.adobe.com/flex/halo"
5
+ xmlns:controllers="cc.varga.mvc.views.controllers.*"
6
+ xmlns:playlisturl="cc.varga.mvc.views.playlisturl.*"
7
+ xmlns:feedloader="cc.varga.mvc.views.blipfm.feedloader.*" xmlns:playlistManager="cc.varga.mvc.views.playlistManager.*" xmlns:search="cc.varga.mvc.views.search.*">
8
+
9
+ <fx:Declarations>
10
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
11
+ </fx:Declarations>
12
+
13
+ <mx:Accordion width="100%" height="100%">
14
+ <s:NavigatorContent label="Player" width="100%" height="100%">
15
+ <controllers:Controllers />
16
+ </s:NavigatorContent>
17
+ <s:NavigatorContent label="Search" width="100%" height="100%">
18
+ <search:Search width="100%" height="50" />
19
+ </s:NavigatorContent>
20
+ <s:NavigatorContent label="Playlist" width="100%" height="100%">
21
+ <playlistManager:PlaylistManager width="100%" height="100%" />
22
+ </s:NavigatorContent>
23
+ <s:NavigatorContent label="Blip.fm" width="100%" height="100%">
24
+ <feedloader:FeedLoader width="100%" height="100%" />
25
+ </s:NavigatorContent>
26
+ </mx:Accordion>
27
+
28
+ </s:Group>
@@ -0,0 +1,30 @@
1
+ package cc.varga.mvc.views.menu
2
+ {
3
+
4
+ import cc.varga.utils.logging.Logger;
5
+
6
+ import org.robotlegs.mvcs.*;
7
+
8
+ public class MenuMediator extends Mediator
9
+ {
10
+
11
+ [Inject]
12
+ public var view : Menu;
13
+
14
+ public function MenuMediator()
15
+ {
16
+ super();
17
+ }
18
+
19
+ override public function onRegister():void{
20
+
21
+ Logger.tracing("onRegister", this.toString());
22
+
23
+ }
24
+
25
+ public function toString():String{
26
+ return "cc.varga.mvc.views.menu.MenuMediator";
27
+ }
28
+
29
+ }
30
+ }
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
3
+ xmlns:s="library://ns.adobe.com/flex/spark"
4
+ xmlns:mx="library://ns.adobe.com/flex/halo">
5
+ <fx:Declarations>
6
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
7
+ </fx:Declarations>
8
+
9
+ <s:Label id="playItemID3" />
10
+
11
+ </s:Group>
@@ -0,0 +1,73 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
3
+ xmlns:s="library://ns.adobe.com/flex/spark"
4
+ xmlns:mx="library://ns.adobe.com/flex/halo"
5
+ xmlns:controllers="cc.varga.mvc.views.controllers.*"
6
+ xmlns:controls="nl.flexcoders.controls.*"
7
+
8
+ width="458" height="100%">
9
+
10
+ <s:layout><s:VerticalLayout/></s:layout>
11
+
12
+ <fx:Script>
13
+ <![CDATA[
14
+ import cc.varga.mvc.events.player.PlayerEvent;
15
+ import cc.varga.mvc.events.playlist.PlaylistURLEvent;
16
+ import cc.varga.utils.logging.*;
17
+
18
+ import mx.events.FlexEvent;
19
+
20
+ private var youtubPlayerLoader : Loader = new Loader();
21
+
22
+ protected function lockBtn_clickHandler(event:MouseEvent):void
23
+ {
24
+ dispatchEvent(new PlayerEvent(PlayerEvent.LOCK));
25
+ }
26
+
27
+ protected function unlockBtn_clickHandler(event:MouseEvent):void
28
+ {
29
+ dispatchEvent(new PlayerEvent(PlayerEvent.UNLOCK));
30
+ }
31
+
32
+ protected function loadpl_clickHandler(event:MouseEvent):void
33
+ {
34
+ dispatchEvent(new PlaylistURLEvent(PlaylistURLEvent.PLAYLIST_LOAD));
35
+ }
36
+
37
+
38
+ protected function savepl_clickHandler(event:MouseEvent):void
39
+ {
40
+ dispatchEvent(new PlayerEvent(PlayerEvent.SAVE_PLAYLIST));
41
+ }
42
+
43
+
44
+ protected function loadBlipFeed_clickHandler(event:MouseEvent):void
45
+ {
46
+ dispatchEvent(new PlayerEvent(PlayerEvent.LOAD_BLIP_FM_FEED));
47
+ }
48
+
49
+ ]]>
50
+ </fx:Script>
51
+
52
+ <s:Group width="100%" height="300" >
53
+ <controls:YouTubePlayer id="youtubePlayer" width="100%" height="100%" autoPlay="true" />
54
+ </s:Group>
55
+
56
+ <controllers:Controllers id="controllers" width="100%" height="55" />
57
+
58
+ <mx:DataGrid id="dataGrid" width="100%" height="100%" fontSize="14">
59
+ <mx:columns>
60
+ <mx:DataGridColumn dataField="title" headerText="Title"/>
61
+ </mx:columns>
62
+ </mx:DataGrid>
63
+
64
+ <s:Group>
65
+ <s:layout><s:HorizontalLayout/></s:layout>
66
+ <s:Button id="lockBtn" label="Lock Player" click="lockBtn_clickHandler(event)" width="100%"/>
67
+ <s:Button id="unlockBtn" label="UnLock Player" click="unlockBtn_clickHandler(event)" width="100%"/>
68
+ <s:Button id="savepl" label="Save Playlist" click="savepl_clickHandler(event)" width="100%"/>
69
+ <s:Button id="loadpl" label="Load Playlist" click="loadpl_clickHandler(event)" width="100%"/>
70
+ <s:Button id="loadBlipFeed" label="Load Blip.fm Feed" click="loadBlipFeed_clickHandler(event)" width="100%"/>
71
+ </s:Group>
72
+
73
+ </s:Group>
@@ -0,0 +1,136 @@
1
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2
+ //
3
+ //Authors: Franics Varga
4
+ //eMail: fv@varga-multimedia.com
5
+ //homepage: http://www.varga-multimedia.com
6
+ //
7
+ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8
+ //<a href='http://creativecommons.org/licenses/by-nc-sa/3.0/'>Creative Commons License<a\>
9
+ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
10
+ //
11
+ //You are free:
12
+ //
13
+ //to Share — to copy, distribute and transmit the work
14
+ //to Remix — to adapt the work
15
+ //Under the following conditions:
16
+ //
17
+ //Attribution — You must attribute the work in the manner specified by the author or licensor
18
+ //(but not in any way that suggests that they endorse you or your use of the work).
19
+ //
20
+ //Noncommercial — You may not use this work for commercial purposes.
21
+ //
22
+ //Share Alike — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
23
+ //
24
+ //With the understanding that:
25
+ //
26
+ //Waiver — Any of the above conditions can be waived if you get permission from the copyright holder.
27
+ //Public Domain — Where the work or any of its elements is in the public domain under applicable law, that status is in no way affected by the license.
28
+ //Other Rights — In no way are any of the following rights affected by the license:
29
+ //
30
+ //Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations; The author's moral rights;
31
+ //
32
+ //Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights.
33
+ //Notice — For any reuse or distribution, you must make clear to others the license terms of this work.
34
+ //The best way to do this is with a link to this web page.
35
+ //
36
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
37
+ package cc.varga.mvc.views.player
38
+ {
39
+ import cc.varga.mvc.events.controllers.ControllersEvent;
40
+ import cc.varga.mvc.events.player.PlayerEvent;
41
+ import cc.varga.mvc.events.playlist.PlaylistURLEvent;
42
+ import cc.varga.mvc.models.player.PlayerModel;
43
+ import cc.varga.mvc.models.playlist.PlaylistModel;
44
+ import cc.varga.mvc.models.sound.SoundModel;
45
+ import cc.varga.mvc.views.blipfm.feedloader.FeedLoader;
46
+ import cc.varga.utils.logging.Logger;
47
+
48
+ import mx.managers.PopUpManager;
49
+
50
+ import org.robotlegs.mvcs.*;
51
+
52
+ public class PlayerWindowMediator extends Mediator
53
+ {
54
+
55
+ [Inject]
56
+ public var view : PlayerWindow;
57
+
58
+ [Inject]
59
+ public var playerModel : PlayerModel;
60
+
61
+ [Inject]
62
+ public var sound : SoundModel;
63
+
64
+ [Inject]
65
+ public var playlist : PlaylistModel;
66
+
67
+ public function PlayerWindowMediator()
68
+ {
69
+ super();
70
+ }
71
+
72
+ override public function onRegister() : void{
73
+
74
+ eventMap.mapListener(eventDispatcher, PlayerEvent.ITEM_ADD_TO_PLAYLIST, onAddItemToPlaylist);
75
+ eventMap.mapListener(eventDispatcher, PlayerEvent.PLAY_YOUTUBE_VIDEO, onPlayYoutubeVideo);
76
+
77
+ eventMap.mapListener(view, PlayerEvent.LOCK, lockPlayer);
78
+ eventMap.mapListener(view, PlayerEvent.UNLOCK, unlockPlayer);
79
+ eventMap.mapListener(view, PlayerEvent.LOAD_BLIP_FM_FEED, onBlipFeedLoader);
80
+
81
+ eventMap.mapListener(view, PlaylistURLEvent.PLAYLIST_LOAD, loadPlaylist);
82
+
83
+ }
84
+
85
+ private function onPlayYoutubeVideo(event : PlayerEvent):void{
86
+
87
+ Logger.tracing("Play Youtube Video", this.toString());
88
+ view.youtubePlayer.videoID = event.youtubeVideoID;
89
+
90
+ }
91
+
92
+ private function onBlipFeedLoader(event : PlayerEvent):void{
93
+
94
+ var loadBlipFeed : FeedLoader = FeedLoader(PopUpManager.createPopUp(contextView, FeedLoader, true));
95
+ PopUpManager.centerPopUp(loadBlipFeed);
96
+
97
+ }
98
+
99
+ private function loadPlaylist(event : PlaylistURLEvent):void{
100
+ Logger.tracing("Dispatching load Playlist Call",this.toString());
101
+ eventDispatcher.dispatchEvent(new PlaylistURLEvent(PlaylistURLEvent.PLAYLIST_LOAD));
102
+ }
103
+
104
+ private function playPlaylist(event : ControllersEvent):void{
105
+
106
+ Logger.tracing("play playlist", this.toString());
107
+
108
+
109
+ }
110
+
111
+ private function lockPlayer(event : PlayerEvent):void{
112
+
113
+ Logger.tracing("lock player", this.toString());
114
+ view.controllers.Btn_next.enabled = false;
115
+ view.controllers.Btn_prev.enabled = false;
116
+
117
+ }
118
+
119
+ private function unlockPlayer(event : PlayerEvent):void{
120
+
121
+ Logger.tracing("unlock", this.toString());
122
+ view.controllers.Btn_next.enabled = true;
123
+ view.controllers.Btn_prev.enabled = true;
124
+
125
+ }
126
+
127
+ private function onAddItemToPlaylist(event : PlayerEvent):void{
128
+
129
+ view.dataGrid.dataProvider = playerModel.playlist;
130
+
131
+ }
132
+
133
+ public function toString():String{ return "cc.varga.mvc.views.player.PlayerWindowMediator"}
134
+ }
135
+
136
+ }
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
3
+ xmlns:s="library://ns.adobe.com/flex/spark"
4
+ xmlns:mx="library://ns.adobe.com/flex/halo">
5
+ <fx:Script>
6
+ <![CDATA[
7
+ import cc.varga.mvc.events.playlist.PlaylistEvent;
8
+ ]]>
9
+ </fx:Script>
10
+
11
+ <fx:Declarations>
12
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
13
+ </fx:Declarations>
14
+
15
+ <s:layout><s:VerticalLayout/></s:layout>
16
+ <s:Scroller width="100%" height="100%" minHeight="100">
17
+ <s:Group id="itemContainer">
18
+ <s:layout><s:VerticalLayout/></s:layout>
19
+ </s:Group>
20
+ </s:Scroller>
21
+
22
+ </s:Group>
@@ -0,0 +1,117 @@
1
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2
+ //
3
+ //Authors: Franics Varga
4
+ //eMail: fv@varga-multimedia.com
5
+ //homepage: http://www.varga-multimedia.com
6
+ //
7
+ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8
+ //<a href='http://creativecommons.org/licenses/by-nc-sa/3.0/'>Creative Commons License<a\>
9
+ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
10
+ //
11
+ //You are free:
12
+ //
13
+ //to Share — to copy, distribute and transmit the work
14
+ //to Remix — to adapt the work
15
+ //Under the following conditions:
16
+ //
17
+ //Attribution — You must attribute the work in the manner specified by the author or licensor
18
+ //(but not in any way that suggests that they endorse you or your use of the work).
19
+ //
20
+ //Noncommercial — You may not use this work for commercial purposes.
21
+ //
22
+ //Share Alike — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
23
+ //
24
+ //With the understanding that:
25
+ //
26
+ //Waiver — Any of the above conditions can be waived if you get permission from the copyright holder.
27
+ //Public Domain — Where the work or any of its elements is in the public domain under applicable law, that status is in no way affected by the license.
28
+ //Other Rights — In no way are any of the following rights affected by the license:
29
+ //
30
+ //Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations; The author's moral rights;
31
+ //
32
+ //Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights.
33
+ //Notice — For any reuse or distribution, you must make clear to others the license terms of this work.
34
+ //The best way to do this is with a link to this web page.
35
+ //
36
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
37
+ package cc.varga.mvc.views.playlist
38
+ {
39
+ import cc.varga.mvc.events.playlist.PlaylistEvent;
40
+ import cc.varga.mvc.events.playlist.PlaylistURLEvent;
41
+ import cc.varga.mvc.models.player.PlayerModel;
42
+ import cc.varga.mvc.models.playlist.PlaylistModel;
43
+ import cc.varga.mvc.models.sound.SoundModel;
44
+ import cc.varga.mvc.views.playlistItem.PlaylistItem;
45
+ import cc.varga.utils.logging.Logger;
46
+
47
+ import org.robotlegs.mvcs.Mediator;
48
+
49
+ public class PlaylistMediator extends Mediator
50
+ {
51
+
52
+ [Inject]
53
+ public var view : Playlist;
54
+
55
+ [Inject]
56
+ public var model : PlaylistModel;
57
+
58
+ [Inject]
59
+ public var playerModel : PlayerModel;
60
+
61
+ [Inject]
62
+ public var soundModel : SoundModel;
63
+
64
+ private var currentLength : uint = 0;
65
+
66
+ public function PlaylistMediator()
67
+ {
68
+ super();
69
+ }
70
+
71
+ override public function onRegister() : void{
72
+
73
+ Logger.tracing("Register PlaylistMediator", this.toString());
74
+
75
+ eventMap.mapListener(eventDispatcher, PlaylistURLEvent.PLAYLIST_DISPLAYED, buildPlaylist);
76
+ eventMap.mapListener(view, PlaylistEvent.ADD_ALL_TO_PLAYLIST, onAddAll);
77
+
78
+ }
79
+
80
+ private function onAddAll(event : PlaylistEvent):void{
81
+
82
+ if(model.listlength() > 0){
83
+ Logger.tracing("add all to playlist", this.toString());
84
+ for(var i:uint=0; i <= model.listlength(); i++){
85
+ playerModel.addItemToPlaylist( model.getItems()[i] );
86
+ }
87
+ }
88
+ }
89
+
90
+ private function buildPlaylist(event : *):void{
91
+ var playlist : Array = model.getItems();
92
+
93
+ if(playlist.length > 0){
94
+
95
+ //if(currentLength < 1 || currentLength != playlist.length){
96
+
97
+ currentLength = playlist.length;
98
+
99
+ for(var i:uint=0; i < playlist.length; i++){
100
+
101
+ var item : PlaylistItem = new PlaylistItem();
102
+ item.jsonObj = playlist[i];
103
+ view.itemContainer.addElement(item);
104
+
105
+ }
106
+ //}else{
107
+ // Logger.tracing("No Changes", this.toString());
108
+ //}
109
+
110
+ }
111
+
112
+ }
113
+
114
+ public function toString():String{ return "cc.varga.mvc.views.playlisturl.list.PlaylistMediator"}
115
+ }
116
+
117
+ }
@@ -0,0 +1,10 @@
1
+ package cc.varga.mvc.views.playlist
2
+ {
3
+ public class PlaylistStates
4
+ {
5
+
6
+ public static const READ_ONLY : String = "readOnly";
7
+ public static const NORMAL : String = "normal";
8
+
9
+ }
10
+ }