auto cut cutome
This commit is contained in:
parent
e7a4f89a0f
commit
512697c99b
Binary file not shown.
13294
package-lock.json
generated
13294
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -8,8 +8,8 @@
|
|||||||
"test": "ng test",
|
"test": "ng test",
|
||||||
"lint": "ng lint",
|
"lint": "ng lint",
|
||||||
"e2e": "ng e2e",
|
"e2e": "ng e2e",
|
||||||
"staging":"ng build --configuration=staging",
|
"staging": "ng build --configuration=staging",
|
||||||
"production":"ng build --prod"
|
"production": "ng build --prod"
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -36,9 +36,9 @@
|
|||||||
"@angular/cli": "~8.3.20",
|
"@angular/cli": "~8.3.20",
|
||||||
"@angular/compiler-cli": "~8.2.14",
|
"@angular/compiler-cli": "~8.2.14",
|
||||||
"@angular/language-service": "~8.2.14",
|
"@angular/language-service": "~8.2.14",
|
||||||
"@types/node": "~8.9.4",
|
|
||||||
"@types/jasmine": "~3.3.8",
|
"@types/jasmine": "~3.3.8",
|
||||||
"@types/jasminewd2": "~2.0.3",
|
"@types/jasminewd2": "~2.0.3",
|
||||||
|
"@types/node": "~8.9.4",
|
||||||
"codelyzer": "^5.0.0",
|
"codelyzer": "^5.0.0",
|
||||||
"jasmine-core": "~3.4.0",
|
"jasmine-core": "~3.4.0",
|
||||||
"jasmine-spec-reporter": "~4.2.1",
|
"jasmine-spec-reporter": "~4.2.1",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe } from '@angular/common';
|
||||||
import * as watermark from 'watermarkjs';
|
// import * as watermark from 'watermarkjs';
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
@ -17,81 +17,81 @@ pipe = new DatePipe('en-US')
|
|||||||
})
|
})
|
||||||
},2000)
|
},2000)
|
||||||
}
|
}
|
||||||
addWatermarks(base64Img,geoCords?) {
|
// addWatermarks(base64Img,geoCords?) {
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
// return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
// this.constant.getGeoTag().then(geoCoordinates => {
|
// // this.constant.getGeoTag().then(geoCoordinates => {
|
||||||
// this.getPosition().then(geoCords=>{
|
// // this.getPosition().then(geoCords=>{
|
||||||
// console.log(geoCords);
|
// // console.log(geoCords);
|
||||||
// this.geoCords = geoCoordinates
|
// // this.geoCords = geoCoordinates
|
||||||
// });
|
// // });
|
||||||
// this.geoCords=localStorage.getItem('current_coordinates')
|
// // this.geoCords=localStorage.getItem('current_coordinates')
|
||||||
// console.log("corrds",this.geoCords)
|
// // console.log("corrds",this.geoCords)
|
||||||
let raw_img = base64Img
|
// let raw_img = base64Img
|
||||||
var today = new Date();
|
// var today = new Date();
|
||||||
// let today_loc = today.toLocaleString('en-US', { timeZone: "Asia/Kolkata" })
|
// // let today_loc = today.toLocaleString('en-US', { timeZone: "Asia/Kolkata" })
|
||||||
let today_loc=this.pipe.transform(today, 'yyyy-MM-dd, h:mm a')
|
// let today_loc=this.pipe.transform(today, 'yyyy-MM-dd, h:mm a')
|
||||||
var date = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate();
|
// var date = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate();
|
||||||
// var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
|
// // var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
|
||||||
var dateTime = 'Date : ' + today_loc;
|
// var dateTime = 'Date : ' + today_loc;
|
||||||
|
|
||||||
console.log(date)
|
// console.log(date)
|
||||||
|
|
||||||
// fetch(raw_img)
|
// // fetch(raw_img)
|
||||||
// .then(res => res.blob())
|
// // .then(res => res.blob())
|
||||||
// .then(blob => {
|
// // .then(blob => {
|
||||||
watermark([raw_img, 'assets/images/PD_watermark.png'])
|
// watermark([raw_img, 'assets/images/PD_watermark.png'])
|
||||||
.image(watermark.image.upperRight())
|
// .image(watermark.image.upperRight())
|
||||||
.then(img => {
|
// .then(img => {
|
||||||
raw_img = img.src;
|
// raw_img = img.src;
|
||||||
|
|
||||||
let text = watermark.text
|
// let text = watermark.text
|
||||||
watermark([raw_img])
|
// watermark([raw_img])
|
||||||
.image(text.upperLeft(dateTime, '19px sans-serif', '#ff0000', 1.0))
|
// .image(text.upperLeft(dateTime, '19px sans-serif', '#ff0000', 1.0))
|
||||||
// .image(text.upperLeft(dateTime, '20px sans-serif', '#ff0000', 1.0))
|
// // .image(text.upperLeft(dateTime, '20px sans-serif', '#ff0000', 1.0))
|
||||||
.then(img => {
|
// .then(img => {
|
||||||
raw_img = img.src;
|
// raw_img = img.src;
|
||||||
console.log("2d", raw_img)
|
// console.log("2d", raw_img)
|
||||||
// resolve(img.src)
|
// // resolve(img.src)
|
||||||
console.log(geoCords)
|
// console.log(geoCords)
|
||||||
// let geoCoordinates = geoCords ? geoCords : '-'
|
// // let geoCoordinates = geoCords ? geoCords : '-'
|
||||||
if(geoCords) {
|
// if(geoCords) {
|
||||||
let Location = `Location : ` + geoCords
|
// let Location = `Location : ` + geoCords
|
||||||
watermark([raw_img])
|
// watermark([raw_img])
|
||||||
.image(text.upperLeft(Location, '19px sans-serif', '#ff0000', 1.0, 40 ))
|
// .image(text.upperLeft(Location, '19px sans-serif', '#ff0000', 1.0, 40 ))
|
||||||
.then(img => {
|
// .then(img => {
|
||||||
raw_img = img.src
|
// raw_img = img.src
|
||||||
console.log("3rd", raw_img)
|
// console.log("3rd", raw_img)
|
||||||
resolve(img.src)
|
// resolve(img.src)
|
||||||
// localStorage.removeItem('current_coordinates')
|
// // localStorage.removeItem('current_coordinates')
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
else {
|
// else {
|
||||||
resolve(img.src)
|
// resolve(img.src)
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
|
|
||||||
|
|
||||||
// },err=>{
|
// // },err=>{
|
||||||
// console.log("Error in geo",err);
|
// // console.log("Error in geo",err);
|
||||||
// switch(err.code) {
|
// // switch(err.code) {
|
||||||
// case 1:
|
// // case 1:
|
||||||
// alert("Geolocation permission is denied. Please allow the permission to capture");
|
// // alert("Geolocation permission is denied. Please allow the permission to capture");
|
||||||
// break;
|
// // break;
|
||||||
// case 2:
|
// // case 2:
|
||||||
// alert("Do not get the geolocation of your place");
|
// // alert("Do not get the geolocation of your place");
|
||||||
// break;
|
// // break;
|
||||||
// case 2:
|
// // case 2:
|
||||||
// alert("Something went wrong");
|
// // alert("Something went wrong");
|
||||||
// break;
|
// // break;
|
||||||
// }
|
// // }
|
||||||
// reject(err);
|
// // reject(err);
|
||||||
// })
|
// // })
|
||||||
})
|
// })
|
||||||
// });
|
// // });
|
||||||
}
|
// }
|
||||||
getPosition(): Promise<any>
|
getPosition(): Promise<any>
|
||||||
{
|
{
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|||||||
@ -124,7 +124,7 @@ export class TwilioService {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
this.roomParticipants = room.participants;
|
this.roomParticipants = room.participants;
|
||||||
console.log(room.participants.size,room.participants)
|
|
||||||
// if(room.participants.size) {
|
// if(room.participants.size) {
|
||||||
// if(room.participants.size >0 && room.participants.size <= 1) {
|
// if(room.participants.size >0 && room.participants.size <= 1) {
|
||||||
room.participants.forEach(participant => {
|
room.participants.forEach(participant => {
|
||||||
@ -132,13 +132,23 @@ export class TwilioService {
|
|||||||
this.openSnackBar(participant.identity+' joined the call','')
|
this.openSnackBar(participant.identity+' joined the call','')
|
||||||
this.msgSubject.next("Already in Room: '" + participant.identity + "'");
|
this.msgSubject.next("Already in Room: '" + participant.identity + "'");
|
||||||
this.attachParticipantTracks(participant);
|
this.attachParticipantTracks(participant);
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
let withoutcustomer = this.getWithOutCustomer(this.roomParticipants)
|
||||||
|
console.log('getWithOutCustomer',withoutcustomer)
|
||||||
if(this.user_data.type == '2') {
|
if(this.user_data.type == '2') {
|
||||||
console.log("User type in service",this.user_data)
|
console.log("User type in service",this.user_data)
|
||||||
let params = {"fk_pd_id":this.user_data.pd_id,"room_id":this.roomObj.sid,"is_call_ended":"0"}
|
let params = {"fk_pd_id":this.user_data.pd_id,"room_id":this.roomObj.sid,"is_call_ended":"0"}
|
||||||
console.log("connected api",params)
|
console.log("connected api",params)
|
||||||
this.sendRoomandStatus(params).subscribe(rr=>{})
|
this.sendRoomandStatus(params).subscribe(rr=>{})
|
||||||
}
|
}
|
||||||
});
|
else if(this.user_data.type == '3' && withoutcustomer == '0'){
|
||||||
|
console.log("User type in service",this.user_data)
|
||||||
|
let params = {"fk_pd_id":this.user_data.pd_id,"room_id":this.roomObj.sid,"is_call_ended":"0"}
|
||||||
|
console.log("connected api",params)
|
||||||
|
this.sendRoomandStatus(params).subscribe(rr=>{})
|
||||||
|
}
|
||||||
// }
|
// }
|
||||||
// else {
|
// else {
|
||||||
// this.openSnackBar("Call is already connected",'')
|
// this.openSnackBar("Call is already connected",'')
|
||||||
@ -187,6 +197,12 @@ export class TwilioService {
|
|||||||
console.log("connected api",params)
|
console.log("connected api",params)
|
||||||
this.sendRoomandStatus(params).subscribe(rr=>{})
|
this.sendRoomandStatus(params).subscribe(rr=>{})
|
||||||
}
|
}
|
||||||
|
// else if(this.user_data.type == '3' && withoutcustomer == '0'){
|
||||||
|
// console.log("User type in service",this.user_data)
|
||||||
|
// let params = {"fk_pd_id":this.user_data.pd_id,"room_id":this.roomObj.sid,"is_call_ended":"0"}
|
||||||
|
// console.log("connected api",params)
|
||||||
|
// this.sendRoomandStatus(params).subscribe(rr=>{})
|
||||||
|
// }
|
||||||
});
|
});
|
||||||
|
|
||||||
// When a Participant adds a Track, attach it to the DOM.
|
// When a Participant adds a Track, attach it to the DOM.
|
||||||
@ -237,7 +253,14 @@ export class TwilioService {
|
|||||||
console.log("Participant Disconnected",participant,participant.sid);
|
console.log("Participant Disconnected",participant,participant.sid);
|
||||||
this.openSnackBar(participant.identity+' left the call','')
|
this.openSnackBar(participant.identity+' left the call','')
|
||||||
this.msgSubject.next("Participant '" + participant.identity + "' left the call");
|
this.msgSubject.next("Participant '" + participant.identity + "' left the call");
|
||||||
// this.disconnect();
|
|
||||||
|
// this.roomParticipants = room.participants;
|
||||||
|
let withoutcustomer = this.getWithOutCustomer(this.roomParticipants)
|
||||||
|
if(this.user_data.type == '1' && withoutcustomer == '0'){
|
||||||
|
this.disconnect();
|
||||||
|
this.msgSubject.next('')
|
||||||
|
}
|
||||||
|
|
||||||
// this.detachParticipantTracks(participant);
|
// this.detachParticipantTracks(participant);
|
||||||
// $(`div#${participant.sid}`, participant).remove();
|
// $(`div#${participant.sid}`, participant).remove();
|
||||||
let parent = document.getElementById('peervideo')
|
let parent = document.getElementById('peervideo')
|
||||||
@ -246,7 +269,7 @@ export class TwilioService {
|
|||||||
console.log(parent,"new",this.remoteVideo.nativeElement,this.remoteVideo.nativeElement.children.length,"Room participants size",this.roomParticipants.size)
|
console.log(parent,"new",this.remoteVideo.nativeElement,this.remoteVideo.nativeElement.children.length,"Room participants size",this.roomParticipants.size)
|
||||||
this.detachParticipantTracks(participant)
|
this.detachParticipantTracks(participant)
|
||||||
|
|
||||||
if(this.roomParticipants.size == 0) {
|
if(this.roomParticipants.size == 0 && this.user_data.type != 1) {
|
||||||
this.msgSubject.next("Waiting for participant...")
|
this.msgSubject.next("Waiting for participant...")
|
||||||
this.btnSubject.next({name:"peerVideoEnable",value:false})
|
this.btnSubject.next({name:"peerVideoEnable",value:false})
|
||||||
}
|
}
|
||||||
@ -272,6 +295,17 @@ export class TwilioService {
|
|||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getWithOutCustomer(participant){
|
||||||
|
let participantWOC: any = []
|
||||||
|
participant.forEach(element => {
|
||||||
|
if(element.identity != 'CUSTOMER'){
|
||||||
|
participantWOC.push(element)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return participantWOC.length
|
||||||
|
}
|
||||||
|
|
||||||
detachParticipantTracks(participant) {
|
detachParticipantTracks(participant) {
|
||||||
for (let track of participant.tracks) {
|
for (let track of participant.tracks) {
|
||||||
Array.from(this.remoteVideo.nativeElement.children).forEach((child:any) => {
|
Array.from(this.remoteVideo.nativeElement.children).forEach((child:any) => {
|
||||||
@ -494,6 +528,8 @@ getTracks(participant) {
|
|||||||
// }});}
|
// }});}
|
||||||
|
|
||||||
disconnect(){
|
disconnect(){
|
||||||
|
let withoutcustomer = this.getWithOutCustomer(this.roomParticipants)
|
||||||
|
console.log('roomObj',this.roomObj,this.user_data.type, withoutcustomer)
|
||||||
if (this.roomObj && this.roomObj !== null) {
|
if (this.roomObj && this.roomObj !== null) {
|
||||||
console.log("User type in service",this.user_data,this.remoteVideo)
|
console.log("User type in service",this.user_data,this.remoteVideo)
|
||||||
if(this.user_data.type == '2' && this.remoteVideo.nativeElement.firstChild != null) {
|
if(this.user_data.type == '2' && this.remoteVideo.nativeElement.firstChild != null) {
|
||||||
@ -501,6 +537,12 @@ disconnect(){
|
|||||||
console.log("disconnected api",params)
|
console.log("disconnected api",params)
|
||||||
this.sendRoomandStatus(params).subscribe(rr=>{})
|
this.sendRoomandStatus(params).subscribe(rr=>{})
|
||||||
}
|
}
|
||||||
|
else if(this.user_data.type == '3' && withoutcustomer == '0'){
|
||||||
|
console.log("User type in service",this.user_data)
|
||||||
|
let params = {"fk_pd_id":this.user_data.pd_id,"room_id":this.roomObj.sid,"is_call_ended":"1"}
|
||||||
|
console.log("disconnected api",params)
|
||||||
|
this.sendRoomandStatus(params).subscribe(rr=>{})
|
||||||
|
}
|
||||||
this.roomObj.disconnect();
|
this.roomObj.disconnect();
|
||||||
this.roomObj = null;
|
this.roomObj = null;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user