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 :
<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:
<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 valuevk_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. Gethashcan only be done in the widget constructor - •
options(object) — block options with widget. An object that can contain fields:- •
width(integerThe width of the block in pixels. By default, the block stretches the entire width of the page.
- •
Example of use
<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.