西瓜播放器 HTML5 video video.js 播放器 HTML5播放器 mp4 hls hls.js flv flv.js dash dash.js 无缝切换

miniscreen

mini window play plug-in。SourceCode

The plugin also contains a switch button plug-in on controls witch named miniscreenicon。SourceCode

pluginName: miniscreen

Note

The plug-in is only registered on the pc side

config

width

  • @type: Number, default: 320
  • @desc: Small window width

height

  • @type: Number, default: 180
  • @desc: Small window height

left

  • @type: Number, default: -1
  • @desc: The distance between the small window and the left side of the screen, the default is bottom left

top

  • @type: Number, default: -1
  • @desc: The distance between the small window and the top of the screen,the default is bottom left

isShowIcon

  • @type: Boolean, default: false
  • @desc: Whether to display the switch button

isScrollSwitch

  • @type: Boolean, default: false
  • @desc: Whether the small window is automatically switched in the scroll state

scrollTop

  • @type: Number, default: 0
  • @desc: Height to trigger scroll,default is 0

disableDrag

  • @type: Boolean, default: false
  • @desc: Whether to disable drag and drop in the small window state

disable

  • @type: Boolean, default: false
  • @desc: Whether to disable the plugin

This configuration item can be controlled by playerConfig.mini, E.g:

const playerConfig = {
  mini: true,
  ...
}

API

getMini()

  • @desc: Enter the small window state

exitMini()

  • @desc: Exit the small window state

props

isMini

  • @type: Boolean

Whether the player is currently in a small window state

event

Events.MINI_STATE_CHANGE

  • value: mini_state_change
  • emit: Triggered when switching to enter/exit the small window

demo

import Player, {Events} from 'xgplayer'

const player = new Player({
  ...,
  mini: true
})

player.on(Events.MINI_STATE_CHANGE, (isMini) => {
  if (isMini) {
    console.log('enter miniScreen')
  } else {
    console.log('exit miniScreen')
  }
})