屏幕截图

  抱歉,这篇文章有英文版

You can make a screenshot of the video via Javascript API with two conditions:
  1. Cross-domain policy allows this (CORS must be configured on the server that distributes the video). More information about this is provided below.
  2. This is video on demand (mp4, ogg, webm), HLS or DASH.

Screenshot taken by the command screenshot

player.api("screenshot");

If possible, the player will return the picture in the format in base64 format (data:image/jpeg). If the screenshot is not impossible, will be returned false.

With PRO you can also enable copyright Plugins / Screenshots / Inscription and specify the text that will be displayed at the bottom of the image.

Screenshot via JS API


Screenshot with your own button

You can also add a custom button to the player's control panel, which will create a screenshot. Just specify the api:screenshot command in the Action field.

Video version of this guide on YouTube

You also need to enable the Show in the corner of the screen option, or Offer to download in the PRO Screenshot plugin. In the first case, when you click on the button, the screenshot will appear in the lower right corner of the screen. The user can save it with the right mouse button (long press on the smartphone), or delete it with a click. In the second case, the player will immediately offer to download the file, as screenshot.jpeg

Watermark

In the Screenshots plugin settings, you can also enable the label that will be displayed in the screenshot in the lower-left corner. You can set the font size and color of the label. Specify domain in the text field and the player uses the domain of the page as the label.

Requirements

Image creating requires cross-domain permission if content is loaded from another domain. Files may require server configuration — the header should contain Access-Control-Allow-Origin: * and the Services / Cross-domain (CORS) option is enabled in the settings. If the video plays muted, then something is wrong with the cross-domain policy (look in the browser console). For HLS and DASH streams everything is usually already set up and no manipulations are needed.


20.0.6
2024 © PlayerJS

登录

登录

免费注册

注册
注册即表示您同意服务条款
登录(如果您有帐户)

恢复密码

恢复
忘记电子邮件?联系我们