Skip to main content

Web Player

The user experience of playing videos is one of the most important aspects of any video platform service. The Arvancloud Web Player is easy to use on different devices, browsers, and applications. Our unique framework is compatible with various devices to provide a pleasant experience for all users.

This document will go through the features, installation, shortcuts, and event structure.

Features

Our player’s features include playing videos and audios, live streaming, supporting multiple dubbed languages, PiP, subtitles, controlling playback speed, choosing different qualities, adding logos and ads, size adaptability, and chapter.

The table below shows all of the features and their descriptions:

FeatureDescription
Video / AudioSupports HLS(.M3u8), DASH(.Mpd), MP3, MP4
On-Demand / Live StreamPlaying Live and On-Demand Videos
TouchCompatible With Touch Screens
ResponsiveCompatible With All Screen Sizes
Multi-InstanceUsing Multiple Instance Versions with Different Configurations on The Same Page
LanguageSupports Both Persian and English Languages
CustomizableChanging Settings and Configurations
Resume PlaybackSupports Resuming Videos
Fullscreen / Picture-In-Picture (Pip)Supports Full-Screen and Picture-In-Picture Modes
LogoDisplays Logo
Multiple AudioSupports Multiple Audio Files for A Video
SubtitleSupports Subtitles
ChapterSupports Dividing the Content into Parts
Speed ControlChanging The Playback Speed
ShortcutsSupports Shortcut Keys
EventsSupports All Player Events or Ads
AdvertisingCompatible With The 2 Standard Modes of Pre-Roll, VAST (V3, V4), And the Other Modes of Mid-Roll, And Post-Roll (Only for The Arvancloud Video Platform)
Quality SelectorManual Change in Quality

Installation

The Arvancloud player is hosted on Arvancloud’s main domain through the config file you receive.

https://player.arvancloud.ir/?config={CONFIG_URL}

You can use it through the player address, iFrame, HTMLElement, or JavaScript.

iFrame

This code will be accessible to you in your user panel after the video conversion process.

<!DOCTYPE html>
<html lang="en">

<head>
<title>ArvanPlayer</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="icon" href="favicon.png" />
</head>

<body>
<iframe id="ir1p" width="560" height="315" frameborder="0" title="{TITLE}" src="https://player.arvancloud.ir/?config={CONFIG_URL}"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen></iframe>
</body>

</html>

HTMLElement

<!DOCTYPE html>
<html lang="en">

<head>
<title>ArvanPlayer</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="icon" href="favicon.png" />
<script type="application/javascript" src="https://player.arvancloud.ir/arvanplayer.min.js"></script>
<style>
html {
/* default */
font-size: 16px;
}
</style>
</head>

<body>
<div id="r1p_container">
<div id="r1p" class="arvanplayer" style="width: 560px; height: 315px;" config="{CONFIG_URL}" data-config='{
"currenttime": 0,
"autostart": false,
"repeat": false,
"mute": false,
"preload": "auto",
"controlbarautohide": true,
"lang": "en",
"aspectratio": "",
"color": "",
"controls": true,
"touchnativecontrols": false,
"displaytitle": true,
"displaycontextmenu": true,
"logoautohide": true
}'></div>
</div>
</body>

</html>

JavaScript

<!DOCTYPE html>
<html lang="en">

<head>
<title>ArvanPlayer</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="icon" href="favicon.png" />
<script type="application/javascript" src="https://player.arvancloud.ir/arvanplayer.min.js"></script>
<style>
html {
/* default */
font-size: 16px;
}
</style>
</head>

<body>
<div id="r1p_container">
<div id="r1p" style="width: 560px; height: 315px;"></div>
<script type="application/javascript">
const ele = document.getElementById('r1p');

// client-side customization, If you don't want to change anything, pass it empty (objConfig = {}).
const objConfig = {
currenttime: 0,
autostart: false,
repeat: false,
mute: false,
preload: "auto",
controlbarautohide: true,
lang: "en",
aspectratio: "",
color: "",
controls: true,
touchnativecontrols: false,
displaytitle: true,
displaycontextmenu: true,
logoautohide: true
};

const player = new ArvanPlayer(ele, // element
'{CONFIG_URL}', // remote config
objConfig, // client-side settings
false); // SecureLink enabled
</script>
</div>
</body>

</html>

Shortcut Keys

The Arvancloud player gives access to a number of shortcut keys to make video control more efficient.

KeyFunction
SpacePause/Resume
KPause/Resume
Rewind a Few Seconds
Fast Forward a Few Seconds
Volume Up
Volume Down
MMute/Unmute
FFull-Screen Mode On / Off
IPip Mode On / Off

Events

The events in code are used to detect the changes in the carrying out of the code. These can result from the actions of the users, such as a mouse click, a change in the size of the player window, etc. Each event is shown with an object and has functions.

EventDescription
progressPeriodically To Check the Content Loading Progress
PlayingWhen The Content Is Played
PlayWhen Playback Is Resumed After a Pause
pauseWhen The Playing Is Paused
timeupdateWhen The Time Shown Is Changed
volumechangeWhen The Volume or Mute Mode Is Changed
seekingWhen The Seek Process Begins
seekedWhen The Seek Process Is Complete
ratechangeWhen The Playback Speed Is Changed
endedWhen The Playback Is Complete. Note: This Event Will Not Happen When Autoplay Is On
fullscreenWhen The Player Enters Full-Screen Mode
exit-fullscreenWhen The Player Exits the Full-Screen Mode
userinactiveWhen The Controls Are Hidden
useractiveWhen The Controls Are Visible
readyWhen The API Call Is Ready
loadstartWhen The Content Loading Begins
loadeddataWhen The First Frame Is Loaded
loadedmetadataWhen Enough Data Is Available to Be Played for Multiple Frames
canplayWhen The Entire Content Can Be Played Without Interruptions
canplaythroughWhen The User Tries to Access Data, It Is Unexpectedly Inaccessible
stalledWhen The Requested Action Is Stalled Because Of Another Action
waitingWhen An Action Is Delayed Because Of Waiting for Another One
emptiedWhen The Content Is Empty
errorWhen There Is an Error
durationchangeWhen The File Duration Is Changed
resizeWhen The Size of The Player Window Is Changed.
suspendWhen The Content Loading Is Suspended
abortWhen The Content Is Not Loaded Completely

Create EventListener

This is possible only in HTMLElement and JavaScript.

Example:

<script type="application/javascript">
const elePlayer = document.getElementById('r1p');

elePlayer.addEventListener('play', (objEvent) => {
// do something
});

elePlayer.addEventListener('pause', (objEvent) => {
// do something
});

elePlayer.addEventListener('timeupdate', (objEvent) => {
// do something
console.info(objEvent.detail); // show current time
});
</script>

Check out the complete ArvanPlayer document to learn more.