Polyv Help Center

Help Center

Using Polyv to Implement Educational Video Preview and Purchase, Let Videos Create Educational Value for You

Updated: 2022-05-24 10:26:31

Scenario

A video tutorial needs to be placed on a website. Users are only allowed to watch for 5 minutes. After that, a prompt appears indicating that registration and purchase are required to continue watching. Clicking it redirects to the login/purchase link.

Principle

Use the watch_end_time parameter of the Polyv player to limit the playback duration. Then, utilize the player's playback end event to trigger s2j_onPlayOver, hide the player, and display an image guiding users to register or purchase.

Implementation Method

Copy the video code from the Polyv video management backend,

Paste it into your website in source code mode. Modify the value of the flashvars parameter, adding watch_end_time=10. For 5 minutes, set it to watch_end_time=300.

<span id="player"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" height="340" id="polyv_player" width="640"><param name="movie" value="http://player.polyv.net/videos/cc3b755ad24a2c9bf54bcffef6a51453_c.swf" /><param name="allowscriptaccess" value="always" /><param name="flashVars" value="watch_end_time=10" /><param name="allowFullScreen" value="true" /><embed allowfullscreen="true" allowscriptaccess="always" flashvars="watch_end_time=10" height="340" name="polyv_player" src="http://player.polyv.net/videos/cc3b755ad24a2c9bf54bcffef6a51453_c.swf" type="application/x-shockwave-flash" width="640"></embed></object></span>

Create an image of 640x340 pixels (matching the video player size). This image will be displayed above the player after the preview time ends, prompting users to purchase.
The image used here is:

Before playback, it is not yet needed. Use a hidden layer with a link for purchase or registration.

 <span id="buylink"><a href="http://pay.polyv.net/purchase.htm?packageId=12"><img alt="" src="/uploads/allimg/130911/1-13091110350RR.png" /></a></span>

Finally, just two lines of JavaScript are needed:

function s2j_onPlayOver()
{
    //alert("播放结束");
        document.getElementById("buylink").style.display = "block";
    document.getElementById("player").style.display = "none";
}
function s2j_onPlayOver()
{
    //alert("Playback ended");
        document.getElementById("buylink").style.display = "block";
    document.getElementById("player").style.display = "none";
}

Final Effect

联系客服,在线咨询