|
@@ -11,6 +11,8 @@ import {
|
|
|
} from '../../../modules/ionic-standalone.modules';
|
|
|
import { AccountService } from '../../../services/account.service';
|
|
|
import { MessageService } from '../../../services/message.service';
|
|
|
+
|
|
|
+declare const Vap: any;
|
|
|
@Component({
|
|
|
selector: 'app-gift-modal',
|
|
|
templateUrl: './gift-modal.component.html',
|
|
@@ -52,10 +54,11 @@ export class GiftModalComponent implements OnInit {
|
|
|
private loadingCtrl: LoadingController,
|
|
|
public accServ: AccountService,
|
|
|
public msgSerrvice: MessageService
|
|
|
- ) {}
|
|
|
-
|
|
|
+ ) {
|
|
|
+ }
|
|
|
async ngOnInit() {
|
|
|
- this.giftList = this.msgSerrvice.giftList
|
|
|
+ this.giftList = this.msgSerrvice.giftList;
|
|
|
+
|
|
|
}
|
|
|
async openModal() {
|
|
|
let uid: any = Parse.User.current()?.id;
|
|
@@ -102,13 +105,14 @@ export class GiftModalComponent implements OnInit {
|
|
|
loading.dismiss();
|
|
|
_this.sendEmit.emit();
|
|
|
_this.isOpenGift = false;
|
|
|
- _this.isShowGiftModal = true;
|
|
|
+
|
|
|
_this.publishGiftMessage(_this.currentGift.id, _this.giftCount);
|
|
|
- setTimeout(() => {
|
|
|
- _this.isShowGiftModal = false;
|
|
|
- console.log(_this.isShowGiftModal);
|
|
|
- console.log('5s后关闭');
|
|
|
- }, 5000);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ this.initPlayer()
|
|
|
})
|
|
|
.catch((err) => {
|
|
|
_this.isOpenGift = false;
|
|
@@ -121,15 +125,48 @@ export class GiftModalComponent implements OnInit {
|
|
|
});
|
|
|
await alert.present();
|
|
|
}
|
|
|
- onCloseGiftModal(){
|
|
|
- if(!this.isShowGiftModal) this.isShowGiftModal = false
|
|
|
+
|
|
|
+
|
|
|
+ initPlayer(){
|
|
|
+ let json = this.currentGift.config
|
|
|
+
|
|
|
+ let dom = document.getElementById('vap-warp');
|
|
|
+ let vapPlayer = new Vap.default({
|
|
|
+ container: dom,
|
|
|
+ src: this.currentGift.video,
|
|
|
+ config: json,
|
|
|
+ width: window.innerWidth,
|
|
|
+ height: window.innerHeight,
|
|
|
+ fps: 30,
|
|
|
+ mute: true,
|
|
|
+ type: 2,
|
|
|
+ loop: false,
|
|
|
+ precache: true,
|
|
|
+ beginPoint: 0,
|
|
|
+ accurate: true,
|
|
|
+ });
|
|
|
+ vapPlayer.play();
|
|
|
+ vapPlayer.on('ended', () => {
|
|
|
+
|
|
|
+ vapPlayer.destroy();
|
|
|
+ vapPlayer = null;
|
|
|
+ console.log(123);
|
|
|
+ });
|
|
|
+ vapPlayer.on('playering', function() { console.log('playering'); })
|
|
|
+ }
|
|
|
+
|
|
|
+ onCloseGiftModal() {
|
|
|
+ if (!this.isShowGiftModal) this.isShowGiftModal = false;
|
|
|
}
|
|
|
|
|
|
- publishGiftMessage(gid:string,count:number) {
|
|
|
+ publishGiftMessage(gid: string, count: number) {
|
|
|
this.msgSerrvice.subscribeMessage(this.toUid, {
|
|
|
message: true,
|
|
|
presence: true,
|
|
|
- });
|
|
|
- this.msgSerrvice.publishMessage(`ONUSERSENDGIFT_${gid}_${count}`,this.toUid);
|
|
|
+ });
|
|
|
+ this.msgSerrvice.publishMessage(
|
|
|
+ `ONUSERSENDGIFT_${gid}_${count}`,
|
|
|
+ this.toUid
|
|
|
+ );
|
|
|
}
|
|
|
}
|