AdPlayer.Pro Video Streaming Capabilities

This article acts a reference to configuration options AdPlayer.Pro supports, regarding its video streaming capabilities, i.e. what media to play, player layout, its webpage behavior, etc.

Overview

The AdPlayer.Pro HTML5 video player enables the smooth streaming of video files in all formats, supported by a viewer’s web browser manufacturer, – across all platforms and screens.

See below for more details regarding the player script code, available configuration options, dynamic content management opportunities, and more.

Player Script Code Example

Your dedicated account manager at AdPlayer.Pro will provide you with the default JS code for further use and customization (see Player Script Configuration Reference below).

Example (static player size):

<div id="divAdPlayerPro"></div>
<script src="https://static.adplayer.pro/player/AdPlayerPro.js"></script>
<script>(function () {
  AdPlayerPro("divAdPlayerPro").setup({
	"placementId": "E4PwNl4FEpNx",
	"muted": true,
	"autoStart": true,
	"width": "640",
	"height": "360",
	"type": "inStream",
	"file": "https://static.adplayer.pro/video/ProPromoVideo.mp4",
	"advertising": {
  	"tag": [
    	{
      	"url": "https://static.adplayer.pro/vast/demo.xml",
    	}
  	]
	}
  })
})();
</script>

Player Script Configuration Reference

NB! JavaScript Object Notation (JSON) is required in the syntax of the setup blocks. Please beware of the common JSON requirements, e.g. the need for a comma after all but the last element in a list, while configuring the script.

Parameter Description Value
"muted"
Configures whether the player is muted during playback start or not.
true/false
"tapToUnmute"
Configures the “Tap to Unmute” button display.
true/false
"soundByHover"
Configures the sound switch-on onhover.
true/false
"autoStart"
Configures whether the player attempts to begin playback automatically or not.
true/false
"width"
Сonfigures the player width:

Static player size – in pixels
Flexible player size – as parent element percentage*

*If aspect ratio is configured – ONLY flexible player size applied (i.e. width MUST be configured as percentage).

number/number%
"height"
Сonfigures the player height*, in pixels.

*If aspect ratio is configured – NOT applied.

number
"aspectratio"
ONLY for flexible player size.

Configures proportions between the player width and height, if player width is configured as percentage, in the following format: x:y, where:

x refers to the player width,
y refers to the player height.

x:y
"type"
Configures the player type.
inStream
"file"
URL to the video content, selected for streaming, i.e.:

  1. on-demand webcasting (MP4 video file), or
  2. live streaming (MPEG-DASH or HLS video).

Examples:

  1. MP4 file:
    "file": "https://example.com/video/1.mp4"
  2. HLS video:
    "file": "https://example.com/video/2.m3u8"
  3. MPEG-DASH video:
    "file": "https://example.com/video/3.mpd"
  1. YouTube video

Example:

"file": {"type":"youtube","videoId":"YouTubeVideoID"},
  1. YouTube playlist

Example:

"file": {"type":"youtubePlaylist","videoId":"YouTubePlaylistID"},
  1. JSON object that contains a number of setup parameters (“rss” or “playlist” – see below).
string/JSON
"file" : {
"type"
Configures the type of video content sequence, if the “file” parameter is a JSON object:

  1. “rss” – refers to an RSS Feed (see a list of specific setup parameters below);

Example:

"file": {
 	"type":"rss"
  	...
},
  1. “playlist” – refers to a playlist of videos (see a list of specific setup parameters
    below).

Example:

"file": {
 	"type":"playlist"
  	...
},
string

Available setup parameters for RSS Feed

"file" : {
"limit"
Configures the maximum number of RSS feed posts enabled for display in-between ad requests.

Default value: 5

number
"file" : {
"url"
Configures the RSS Feed URL.

Example:

"file": {
	"type":"rss",
	"limit": "5",
	"url": "/player/xml/rss/jpostParsePage.com.rss.xml",
	...
	},
string
"file " : {
"speed"
Configures the RSS feed post duration in seconds.

Default value: 6

number
"file" : {
"parsePage"
Optional.
If ON, switches webpage parsing for images, if there are no images in the RSS Feed.

Note! The “parsePage” parameter will only work in case the custom parser script is applied (i.e.
see the “parser” parameter below), and may increase server load.

true/false
"file" : {
"parser"
Optional.
If added, configures the custom script for parsing webpage content. If missing, the following default parser
script is applied:

{
  title: function () {
	return $item.find('title').text();
  },
  link: function () {
	return $item.find('link').text();
  },
  img: function () {
	return $("<b>" + $item.find('description').text()
	+ '</b>').find('img').attr('src');
  }
},

The parser script supports the following variables:

  1. parser – object
  2. $ – jquery
  3. $item – jquery object. Refers to the item from RSS Feed
  4. page (undefined by default) – HTML string. Refers to the webpage where the item is located
  5. $page (undefined by default) – jquery object. Refers to the webpage where the item is
    located

EXAMPLE, with a custom parser script, used for parsing images on the webpage (actual script may
differ):

"file": {
       	"type": "rss",
       	"limit": "5",
       	"url": "/player/xml/rss/jpostParsePage.com.rss.xml",
       	"parsePage": "true",
           "parser":
         	"parser.img = function () { return $("<b>"
         	+ $item.find("description").text()
         	+ "</b>").find("img").attr("src")
         	|| ($page && $page.find(".article-image img").attr("src"))}"
  	},
string (Javascript)

Available setup parameters for video playlists

"file" : {
"name"
Configures the video playlist name.
Example:

"file": {
	"type":"playlist",
	"name": "MyPlaylist",
	"playlist": [ … ]
   	},
string
"file" : {
"playlist": []
For each video file in the playlist, you can configure the following parameters:

  1. “file” – URL. Configures the direct download link to the video file.
  2. “duration” – number. Configures video duration in seconds.
  3. “title” – string. Refers to the title of the video.
  4. “image” – URL. Configures the direct link to a thumbnail image.
  5. “description” – string. Configures a video file description (the est. limit of characters
    is ~2 lines max., but this value may differ depending on the platform/screen size).

Example:

"file": {
	"type":"playlist",
	"playlist": [
    	{"file": "https://adplayer.pro/video/1.mp4",
     	"duration": "10",
     	"title": "One",
     	"image": "https://adplayer.pro/img/1.jpg",
     	"description": "This is Video One"},
    	{"file": "https://adplayer.pro/video/2.mp4",
    	...
     	}
  	]
  },

string
 "tracks": [{
Sequence of parameters, configuring the display of image thumbnails in video (VTT).

See below.

 "tracks": [{
"file"
Configures the URL to the externally hosted *.vtt file.
Example:

"file": "https://example.com/preview.vtt"
string
 "tracks": [{
"kind"
Optional.
Configures the VTT type.
Example:

"kind": "thumbnails"
string
"errorMessage"
Configures the error message describing what went wrong.

Example:

"errorMessage": "Video is not available"
string

Dynamic Content Management

AdPlayer.Pro enables managing streamed video content programmatically by a mere few clicks – by changing the “file” parameter value (URL).