[vlc-devel] [PATCH] Modified the API to allow Javascript to accessthe index of the currently playing playlist item.

Guy Perkins me at atdotmedotuk.me.uk
Thu Apr 24 19:25:18 CEST 2014


Apologies to all for butting in.
Andrew, are you referring to Javascript access via a browser activex plugin?
If so, I have a problem that I have been looking for someone to help resolve
for over a year now regarding the 'options' during 'add'. 

vlc.playlist.add(......OPTIONS)

I cannot get this to work with IE9 or 10, the plugin only appears to receive
the first item from the options array. (Works fine in 8, and using alt
browser is not an option)

If you think that you might be able to assist at all, can we direct email
and discuss.

Guy

-----Original Message-----
From: vlc-devel [mailto:vlc-devel-bounces at videolan.org] On Behalf Of Andrew
Armstrong
Sent: 24 April 2014 15:48
To: vlc-devel at videolan.org
Cc: Andrew Armstrong
Subject: [vlc-devel] [PATCH] Modified the API to allow Javascript to
accessthe index of the currently playing playlist item.

---
 npapi/npruntime/npolibvlc.cpp |    8 ++++++++
 npapi/vlcplugin_base.h        |    4 ++++
 2 files changed, 12 insertions(+)

diff --git a/npapi/npruntime/npolibvlc.cpp b/npapi/npruntime/npolibvlc.cpp
index a930f9e..05c26c9 100644
--- a/npapi/npruntime/npolibvlc.cpp
+++ b/npapi/npruntime/npolibvlc.cpp
@@ -835,6 +835,7 @@ const NPUTF8 * const
LibvlcPlaylistNPObject::propertyNames[] =
     "itemCount", /* deprecated */
     "isPlaying",
     "items",
+    "currentItem",
 };
 COUNTNAMES(LibvlcPlaylistNPObject,propertyCount,propertyNames);
 
@@ -843,6 +844,7 @@ enum LibvlcPlaylistNPObjectPropertyIds
     ID_playlist_itemcount,
     ID_playlist_isplaying,
     ID_playlist_items,
+    ID_playlist_currentItem,
 };
 
 RuntimeNPObject::InvokeResult
@@ -873,6 +875,12 @@ LibvlcPlaylistNPObject::getProperty(int index,
NPVariant &result)
                 OBJECT_TO_NPVARIANT(NPN_RetainObject(playlistItemsObj),
result);
                 return INVOKERESULT_NO_ERROR;
             }
+            case ID_playlist_currentItem: 
+            {
+                int val = p_plugin->playlist_current_item();
+                INT32_TO_NPVARIANT(val, result);
+                return INVOKERESULT_NO_ERROR;
+            }
             default:
                 ;
         }
diff --git a/npapi/vlcplugin_base.h b/npapi/vlcplugin_base.h
index c066b93..a75ff57 100644
--- a/npapi/vlcplugin_base.h
+++ b/npapi/vlcplugin_base.h
@@ -152,6 +152,10 @@ public:
     {
         return get_player().items_count();
     }
+    int  playlist_current_item()
+    {
+        return get_player().current_item();
+    }
     bool playlist_select(int);
 
     void control_handler(vlc_toolbar_clicked_t);
-- 
1.7.9.5

_______________________________________________
vlc-devel mailing list
To unsubscribe or modify your subscription options:
https://mailman.videolan.org/listinfo/vlc-devel




More information about the vlc-devel mailing list