// import { MovieClip } from './../../libs/svga/MovieClip';
// import { Parser } from './../../libs/svga/parser';
export default class SVGACtrl {

    static _instance: SVGACtrl;

    public SVGAPool: any[] = [];

    public static get instance() { return SVGACtrl._instance || (SVGACtrl._instance = new SVGACtrl()) }

    public load(path) {
        return new Promise((resolve, reject) => {
            let parser = new window['SVGA'].Parser();
            parser.load(path, (videoItem) => {
                var mv = new window['SVGA'].EgretMovieClip(videoItem)
                this.SVGAPool.push(mv)
                resolve(mv);
                let fun
                mv.addEventListener(egret.Event.COMPLETE, fun = function () {
                    console.log("svga加载完成")
                    mv.removeEventListener(egret.Event.COMPLETE, fun, this)
                    mv.stop()
                    mv.startAniRange(30, 60);
                }, this)
            }, function (error) {
                reject(error.message)
            })
        })
    }

    public play() {

    }
}
