Polyv Help Center

Help Center

Video and Cover

Updated: 2022-05-16 10:08:41

Feature Introduction

Player video playback and custom cover image display before the video starts playing.

Feature API

Parameters:

Parameter Type Default Description
wrap String / HTMLElement DOM element or CSS selector on the page that needs to load the player
vid String A unique video vid generated after uploading a video from the polyv backend
width Number / String Player width
height Number / String Player height
url String Custom player URL
loading_bg_img String Cover image setting

Parameter setting example

var player = polyvPlayer({
    wrap: '#player',
    width: 800,
    height: 533,
    vid: 'e8888b74d1229efec6b4712e17cb6b7a_e',
});

Methods:

Method Name Parameters Return Value Description
j2s_getDuration Number Get total video duration
j2s_getCurrentTime
j2s_resumeVideo

Method call example

player.j2s_getDuration(); // 540

Events:

Event Name Return Value Description
s2j_onPlayerInitOver Player data initialization complete
s2j_onPlayStart Triggered when the player successfully loads the video file and completes buffering, just before starting to play the 1st second
s2j_onVideoPlay Triggered on play event
s2j_onVideoPause Triggered on pause event
s2j_onFullScreen Triggered on fullscreen event
s2j_onNormalScreen Triggered on normal screen event

Event listener example

player.on('s2j_onPlayerInitOver', function() {
    console.info('播放器数据初始化完毕');
});

Tips:

  • If an incompatible browser is detected, such as IE10 or IE9, it will automatically switch to the Flash player
  • To check if a PC browser supports H5, call player.isSupportHTML5 to detect

Online Demo JS RUN

联系客服,在线咨询