| 123456789101112131415161718192021222324252627 |
- import EZUIKit from 'ezuikit-js'
- export default class EzVideoService {
- player = null as unknown as EZUIKit.EZUIKitPlayer | null
- init(option: EZUIKit.EZUIKitPlayerOptions, callBack?: (e: any) => void) {
- if (this.player) this.destory()
- this.player = new EZUIKit.EZUIKitPlayer({
- ...option,
- template: 'simple',
- handleError: (err) => {
- console.error('handleError', err)
- if (callBack) callBack(err)
- },
- handleSuccess: (res) => {
- console.info('handleSuccess', res)
- if (callBack) callBack(res)
- }
- })
- this.player.play()
- return this.player
- }
- destory() {
- if (this.player) this.player.stop()
- this.player = null
- }
- }
|