screenshot
screenshot plugin。SourceCode
pluginName: screenshot
The plug-in is hidden by default, if you need to enable the following configuration playerConfig
const player = new Player({
  ...,
  screenShot: true //Show screenshot icon
})
// OR
const player = new Player({
  ...,
  screenShot: {
    disable: false
  } //Show screenshot icon
})
注意
Be sure to configure the crossOrigin for the player in advance, otherwise canvas toDataURL will trigger an error: 
"Uncaught SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement': tainted canvases may not be exported."
config
position
- @type:- String
- default:- POSITIONS.ROOT_RIGHTFor specific enumeration values, please see plugin-positions
index
- @type:- Number
- default:- 6
quality
- @type:- Number
- default:- 0.92
- description: quality of the generated pictures,default is 0.92
type
- @type:- String
- default:- image/png
- description: format of picture,default is- image/png
format
- @type:- String
- default:- .png
- description: Picture storage format, default- .png
width
- @type:- Number
- default:- 600
- description: Picture width
height
- @type:- Number
- default:- 337
- description: Picture height
disable:
- @type:- Boolean
- default:- false
- description: whether to disable
API
shot(width, height, option)
- @desc: screenshot
- @param:- { Number } widthscreenshot width
- @param:- { Number } heightscreenshot height
- @param:- { {quality: Number, type: String} } option, default is- { quality: 0.92, type: 'image/png' }
- @return:- Promise<string>
saveScreenShot(data, filename)
- @desc: download image
- @param:- { String } dataimage url, base64 or url string
- @param:- { String } filenamePicture name
events
Events.SCREEN_SHOT
- value: screenShot
- Trigger Timing: Click the screenshot button and the screenshot is successful
const player = new Player({
  ...
})
player.on(Events.SCREEN_SHOT, (url)) => {
  console.log('screen shot success')
})