Commit 54d9ca8f authored by liujiangnan's avatar liujiangnan

feat: 添加_l处理

parent 95abd31c
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "ng-template-generator",
"version": "0.0.1",
"scripts": {
"start": "ng serve",
"scripts": {
"start": "ng serve",
"build": "ng build --build--optimizer --aot --base-href /JGT/v3/",
"publish": "node ./bin/publish.js"
"publish": "node ./bin/publish.js"
},
"private": true,
"dependencies": {
......@@ -43,6 +43,7 @@
"nedb": "^1.8.0",
"ng-lottie": "^0.3.1",
"ng-zorro-antd": "^7.2.0",
"node-sass": "^4.14.1",
"npm": "^6.5.0",
"rxjs": "^6.3.3",
"rxjs-compat": "^6.3.3",
......
......@@ -30,9 +30,64 @@ export class PlayComponent implements AfterViewInit, OnInit, OnDestroy {
constructor(private appRef: ApplicationRef) {
}
httpHeadCall(requsetUrl, callback) {
let xhr = new XMLHttpRequest();
console.log("Status: Send Post Request to " + requsetUrl);
try {
xhr.onreadystatechange = () => {
try {
console.log('xhr.readyState: ', xhr.readyState);
if (xhr.readyState == 4) {
if ((xhr.status >= 200 && xhr.status < 400)) {
callback(true);
} else {
callback(false);
}
}
} catch (e) {
console.log(e)
}
};
xhr.open("HEAD", requsetUrl, true);
// xhr.setRequestHeader('content-type', 'application/json');
// xhr.setRequestHeader('token', this.token);
// xhr.send(JSON.stringify(requestData));
xhr.send();
xhr.timeout = 15000;
xhr.onerror = (e) => {
console.log("汪汪汪 posterror", e);
callback(false);
};
xhr.ontimeout = (e) => {
console.log("汪汪汪 ontimeout", e);
callback(false);
};
} catch (e) {
console.log("Send Get Request error: ", e)
}
}
getVideoUrl() {
const url1 = this.data.contentObj.video_url;
const url2 = url1.replace(/.mp4$/g, "_l.mp4");
this.httpHeadCall(url2, (success) => {
if (success) {
this.data.contentObj.video_url = url2;
}
})
}
ngOnInit() {
// console.log(this.data.contentObj)
// this.hasVideo = !!this.data.contentObj.video_url && typeof this.data.contentObj.video_url === 'string';
this.data = {};
this.data.contentObj = {};
......@@ -54,6 +109,9 @@ export class PlayComponent implements AfterViewInit, OnInit, OnDestroy {
this.initDefaultData();
console.log('this.data.contentObj.video_url: ', this.data.contentObj.video_url);
if (this.data.contentObj.video_url) {
this.getVideoUrl();
}
this.hasVideo = !!this.data.contentObj.video_url && typeof this.data.contentObj.video_url === 'string';
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment