feat(boxing): return stream video
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
d040ecb743
commit
7d4dd7bb52
|
@ -7,7 +7,7 @@ CREATE TABLE `vn`.`packingSiteConfig` (
|
|||
);
|
||||
|
||||
INSERT INTO `vn`.`packingSiteConfig` SET
|
||||
shinobiUrl = 'https://shinobi.verdnatura.es/',
|
||||
shinobiUrl = 'http://shinobi.verdnatura.es',
|
||||
shinobiGroupKey = 'xVqft9LFXg',
|
||||
avgBoxingTime = 30;
|
||||
|
||||
|
|
|
@ -8,13 +8,13 @@ module.exports = Self => {
|
|||
{
|
||||
arg: 'id',
|
||||
type: 'number',
|
||||
required: true,
|
||||
required: false,
|
||||
description: 'Ticket id'
|
||||
},
|
||||
{
|
||||
arg: 'time',
|
||||
type: 'number',
|
||||
required: true,
|
||||
required: false,
|
||||
description: 'Time to add'
|
||||
}
|
||||
],
|
||||
|
@ -31,35 +31,37 @@ module.exports = Self => {
|
|||
Self.getVideo = async(id, time, options) => {
|
||||
const models = Self.app.models;
|
||||
const myOptions = {};
|
||||
|
||||
console.log('ENTRY');
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
const expedition = await models.Expedition.findById(id, null, myOptions);
|
||||
const packingSiteConfig = await models.PackingSiteConfig.findOne({}, myOptions);
|
||||
const token = await Self.getToken(packingSiteConfig);
|
||||
const monitorId = 'xVqft9LFXg';
|
||||
const token = 'BW4o7FZyJ85she1hlRDe6QnwW3jwEP';
|
||||
const groupKey = 'xVqft9LFXg';
|
||||
const monitorId = 'VbiUcajdaT';// 'xVqft9LFXg';
|
||||
|
||||
const start = new Date(expedition.created);
|
||||
const end = start.setTime(start.getTime() + (time ? time : packingSiteConfig.avgBoxingTime));
|
||||
const start = '2022-07-27T09:00:00';// new Date('2022-07-27'); // new Date(expedition.created);
|
||||
const end = '2022-07-27T09:15:00';// start.setTime(start.getTime() + (time ? time : packingSiteConfig.avgBoxingTime));
|
||||
|
||||
const videoUrl = `${token}/videos/${packingSiteConfig}/${monitorId}?start=${start}&end=${end}`;
|
||||
const videos = await axios.post(`${packingSiteConfig.shinobiUrl}${videoUrl}`, {
|
||||
mail: packingSiteConfig.mail,
|
||||
pass: packingSiteConfig.pass
|
||||
});
|
||||
const videoUrl = `/${token}/videos/${groupKey}/${monitorId}?start=${start}&end=${end}`;
|
||||
const url = `${packingSiteConfig.shinobiUrl}${videoUrl}`;
|
||||
const data = await axios.post(url);
|
||||
|
||||
console.log(videos);
|
||||
return videos.data;
|
||||
};
|
||||
console.log(data.data.videos);
|
||||
console.log('-----------------------');
|
||||
console.log('-----------------------');
|
||||
console.log('-----------------------');
|
||||
console.log('-----------------------');
|
||||
|
||||
Self.getToken = async function getToken(packingSiteConfig) {
|
||||
const response = await axios.post(`${packingSiteConfig.shinobiUrl}?json=true`, {
|
||||
machineID: 1,
|
||||
ke: 'hola',
|
||||
});
|
||||
|
||||
console.log(response);
|
||||
return response.data;
|
||||
axios({
|
||||
method: 'get',
|
||||
url: `${packingSiteConfig.shinobiUrl}${data.data.videos[0].href}`,
|
||||
responseType: 'stream'
|
||||
})
|
||||
.then(response => {
|
||||
console.log(response);
|
||||
return response;
|
||||
});
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,2 +1,5 @@
|
|||
<vn-card>
|
||||
<video id="videobcg" muted="muted" controls class="video">
|
||||
<source src="http://localhost:5000/api/Boxings/getVideo?id=1" type="video/mp4" autoplay="autoplay" >
|
||||
</video>
|
||||
</vn-card>
|
||||
|
|
|
@ -7,7 +7,7 @@ class Controller extends Section {
|
|||
}
|
||||
|
||||
$onInit() {
|
||||
window.location.href = this.lilium('dashboard');
|
||||
// window.location.href = this.lilium('dashboard');
|
||||
}
|
||||
|
||||
lilium(route) {
|
||||
|
|
Loading…
Reference in New Issue