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

Jean-Baptiste Kempf jb at videolan.org
Sat Apr 26 11:52:22 CEST 2014


It's good, but misses the ActiveX counter-part.


On 24 Apr, Andrew Armstrong wrote :
> ---
>  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

-- 
With my kindest regards,

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device



More information about the vlc-devel mailing list