summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdwin Eefting <edwin@datux.nl>2013-01-21 00:32:38 (GMT)
committer Edwin Eefting <edwin@datux.nl>2013-01-21 00:32:38 (GMT)
commitda381722f921a2d1fb5ec3e5c5a1965040edfe35 (patch)
treea32d7681a0e9d1f04c3b73306827c7755b9dab53
parent56a91bbb7fd79fdc533802ca162e7c5459d1370a (diff)
mp webinterface thingy basics working
-rw-r--r--modules/pl_dir.module/module.cpp26
-rw-r--r--modules/play_vlc.module/module.cpp30
-rw-r--r--wwwdir/mp.html83
3 files changed, 124 insertions, 15 deletions
diff --git a/modules/pl_dir.module/module.cpp b/modules/pl_dir.module/module.cpp
index c339fa0..4a0282b 100644
--- a/modules/pl_dir.module/module.cpp
+++ b/modules/pl_dir.module/module.cpp
@@ -512,7 +512,7 @@ namespace pl
*/
SYNAPSE_REGISTER(pl_GetStatus)
{
- iterMan.get(msg.dst).send(msg.src);
+ iterMan.get(dst).send(msg.src);
}
/** Select next directory entry in list
@@ -522,8 +522,8 @@ namespace pl
*/
SYNAPSE_REGISTER(pl_NextDir)
{
- iterMan.get(msg.dst).nextDir();
- iterMan.get(msg.dst).send(0);
+ iterMan.get(dst).nextDir();
+ iterMan.get(dst).send(0);
}
@@ -535,8 +535,8 @@ namespace pl
*/
SYNAPSE_REGISTER(pl_PreviousDir)
{
- iterMan.get(msg.dst).previousDir();
- iterMan.get(msg.dst).send(0);
+ iterMan.get(dst).previousDir();
+ iterMan.get(dst).send(0);
}
/** Enters selected directory
@@ -546,8 +546,8 @@ namespace pl
*/
SYNAPSE_REGISTER(pl_EnterDir)
{
- iterMan.get(msg.dst).enterDir();
- iterMan.get(msg.dst).send(0);
+ iterMan.get(dst).enterDir();
+ iterMan.get(dst).send(0);
}
/** Exits directory, selecting directory on higher up the hierarchy
@@ -557,8 +557,8 @@ namespace pl
*/
SYNAPSE_REGISTER(pl_ExitDir)
{
- iterMan.get(msg.dst).exitDir();
- iterMan.get(msg.dst).send(0);
+ iterMan.get(dst).exitDir();
+ iterMan.get(dst).send(0);
}
@@ -569,8 +569,8 @@ namespace pl
*/
SYNAPSE_REGISTER(pl_Next)
{
- iterMan.get(msg.dst).next();
- iterMan.get(msg.dst).send(0);
+ iterMan.get(dst).next();
+ iterMan.get(dst).send(0);
}
@@ -581,8 +581,8 @@ namespace pl
*/
SYNAPSE_REGISTER(pl_Previous)
{
- iterMan.get(msg.dst).previous();
- iterMan.get(msg.dst).send(0);
+ iterMan.get(dst).previous();
+ iterMan.get(dst).send(0);
}
diff --git a/modules/play_vlc.module/module.cpp b/modules/play_vlc.module/module.cpp
index 0bbb83b..9030885 100644
--- a/modules/play_vlc.module/module.cpp
+++ b/modules/play_vlc.module/module.cpp
@@ -444,7 +444,6 @@ class CPlayer
{
throwIfBad();
- stop();
mVlcUrl=url;
@@ -461,6 +460,8 @@ class CPlayer
//clear the list
while(libvlc_media_list_count(mList))
{
+ INFO("remove");
+
libvlc_media_list_remove_index(mList, 0);
}
@@ -471,6 +472,7 @@ class CPlayer
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LOCKED
//command the list player to play
+ libvlc_media_list_player_next(mListPlayer);
libvlc_media_list_player_play(mListPlayer);
libvlc_media_release(m);
@@ -493,6 +495,16 @@ class CPlayer
}
}
+ void pause()
+ {
+ libvlc_media_player_pause(mPlayer);
+ }
+
+ void setTime(int time)
+ {
+ libvlc_media_player_set_time(mPlayer, time);
+ }
+
};
typedef map<int, CPlayer> CPlayerMap;
@@ -613,7 +625,7 @@ SYNAPSE_REGISTER(play_NewPlayer)
*/
SYNAPSE_REGISTER(play_Open)
{
- lock_guard<recursive_mutex> lock(vlcMutex);
+ //lock_guard<recursive_mutex> lock(vlcMutex);
INFO("vlc opening " << msg["url"].str());
@@ -632,6 +644,20 @@ SYNAPSE_REGISTER(play_Stop)
players[dst].stop();
}
+SYNAPSE_REGISTER(play_Pause)
+{
+ lock_guard<recursive_mutex> lock(vlcMutex);
+
+ players[dst].pause();
+}
+
+
+SYNAPSE_REGISTER(play_SetTime)
+{
+ lock_guard<recursive_mutex> lock(vlcMutex);
+
+ players[dst].setTime(msg["time"] * 1000);
+}
/** Gets status of player.
* This is just to allow new clients to get the latest events.
diff --git a/wwwdir/mp.html b/wwwdir/mp.html
new file mode 100644
index 0000000..87ef1f5
--- /dev/null
+++ b/wwwdir/mp.html
@@ -0,0 +1,83 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+
+<html>
+
+<head>
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+ <title>Mindfull player</title>
+
+ <script type="text/javascript" src="/synapse/synapse.js"></script>
+
+ <script type="text/javascript">
+
+ /// SYNAPSE EVENT HANDLERS
+
+
+ synapse_register("error",function(errortxt)
+ {
+ $('#error').html(errortxt);
+ });
+
+
+ synapse_register("module_SessionStart",function(msg_src, msg_dst, msg_event, msg)
+ {
+ send(1, "core_Login", {
+ username: "admin",
+ password: "as"
+ });
+
+ });
+
+ synapse_register("module_Login",function(msg_src, msg_dst, msg_event, msg)
+ {
+ //get status from player
+ send(0, "play_GetStatus", {
+ });
+
+ //translate clicks on elements that have the send-class to a synapse event:
+ $(".send").click(function()
+ {
+ send(0,$(this).attr("event"));
+ });
+
+ //volume slider
+ $(".time").slider({
+ min: 0,
+ slide: function (event, ui)
+ {
+ send(0,"play_SetTime", { 'time': ui.value } );
+ }
+ });
+
+
+
+ });
+
+ synapse_register("play_Time",function(msg_src, msg_dst, msg_event, msg)
+ {
+ $(".time").slider("value", msg['time']);
+ $(".time").slider("option", "max", msg['length']);
+ });
+
+
+
+ </script>
+
+ <style>
+
+
+ </style>
+</head>
+
+
+<body>
+<button class="send" event="pl_Previous">Previous</button>
+<button class="send" event="play_Pause">Pause</button>
+<button class="send" event="play_Stop">Stop</button>
+<button class="send" event="pl_Next">Next</button>
+<div class="time"></div>
+
+
+</body>
+</html>
+