const { DHFactory } = require("./DHFactory");

export class DHResource{
    constructor(params){
        this.params = params;
        this.sp = params.config.endpoint.sp||"tencent";
    }
    async init(){
        this.DHResource=DHFactory.getInstance(this.sp,this.params);
        return  await this.DHResource.init();
    }

    async command(param){
        this.DHResource=DHFactory.getInstance(this.sp,this.params);
        return  await this.DHResource.command(param);
    }

    async commandChannel(param){
        this.DHResource=DHFactory.getInstance(this.sp,this.params);
        return  await this.DHResource.commandChannel(param);
    }

}
export async function startAdapterDH(data,oSink){
    if (oSink.config.endpoint.sp == "tencentNew") {
        data.result={url:data.Payload.PlayStreamAddr};
    }

    return data;
}

