The translation was generated automatically and may contain mistakes

Playlist

With this widget, you can easily and quickly add an album of your favorite band to your site, talk about your own new record or share a fresh selection of music.

The widget adds a block to the site page with a playlist of the user or the VKontakte community.. The first five songs can be listened to without leaving your site, the full list is available at the link to the vk.com> The user can add the entire playlist or individual songs to their audio list, as well as share it with friends or the community.

Widget connection

To add a playlist widget to your site, follow these steps:

Step 1. In the tag <head> On your website, add a link. openapi.js :

HTML
<script src="https://vk.com/js/api/openapi.js?169" type="text/javascript"></script>

Step 2. Add an element to the body of the page <div> , in which the widget will be displayed, set it to unique id and add a widget initialization code to it. For example:

HTML
<div id="my_playlist"></div> <script type="text/javascript"> VK.Widgets.Playlist('my_playlist', -2000002200, 2200, 'becc04fc11973e4b92'); </script>

If your website is already in use Open API , adding a widget is even easier. Simply add widget initialization.

Additional settings

Widget creation method VK.Widgets.Playlist It takes parameters:

  • element_id ( string ), the mandatory parameter is the id of the element that will be the button container for communication. Our default constructor uses a value vk_playlist_ + {owner_id} + {playlist_id} .
  • owner_id ( integer ), a mandatory parameter — the identifier of the playlist owner.
  • playlist_id ( integer ), the mandatory parameter is the playlist identifier.
  • hash ( string ), a mandatory parameter is a service parameter. Get hash can only be done in the widget constructor
  • options ( object ) — block options with widget. An object that can contain fields:
    • width ( integer The width of the block in pixels. By default, the block stretches the entire width of the page.

Example of use

HTML
<script type="text/javascript" src="//vk.com/js/api/openapi.js?143"></script> <span class="wk_comment"> VK Widget </span> <div id="vk_playlist_-2000002200_2200"></div> <script type="text/javascript"> VK.Widgets.Playlist('vk_playlist_-2000002200_2200', -2000002200, 2200, 'becc04fc11973e4b92', {width: 200}); </script>

Код виджета

To add a widget to your site, simply copy the code to paste to the page you want to place the widget on.

Playlist URL
Width
Code for embedding widget on website
HTML
<!-- Put this script tag to the <head> of your page --> <script type="text/javascript" src="https://vk.ru/js/api/openapi.js?168" charset="windows-1251" ></script> <!-- Put this script tag to the place, where the Playlist block will be --> <div id='vk_playlist_-147845620_5'></div> <script type="text/javascript"> VK.Widgets.Playlist('vk_playlist_-147845620_5', -147845620, 5, 'c09c1c34cdf7190efb'); </script>