mirror of
https://github.com/immich-app/immich.git
synced 2025-05-31 12:15:47 -04:00
Fixed issue socket-io cannot be connected in production build on web
This commit is contained in:
parent
1e3464fe47
commit
c4247bfea3
@ -244,7 +244,7 @@ export class AssetService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Sending Partial Content With HTTP Code 206 */
|
/** Sending Partial Content With HTTP Code 206 */
|
||||||
|
console.log('send partial', end - start + 1);
|
||||||
res.status(206).set({
|
res.status(206).set({
|
||||||
'Content-Range': `bytes ${start}-${end}/${size}`,
|
'Content-Range': `bytes ${start}-${end}/${size}`,
|
||||||
'Accept-Ranges': 'bytes',
|
'Accept-Ranges': 'bytes',
|
||||||
|
@ -45,26 +45,32 @@
|
|||||||
const loadVideoData = async () => {
|
const loadVideoData = async () => {
|
||||||
isThumbnailVideoPlaying = false;
|
isThumbnailVideoPlaying = false;
|
||||||
const videoUrl = `/asset/file?aid=${asset.deviceAssetId}&did=${asset.deviceId}&isWeb=true`;
|
const videoUrl = `/asset/file?aid=${asset.deviceAssetId}&did=${asset.deviceId}&isWeb=true`;
|
||||||
|
|
||||||
if ($session.user) {
|
if ($session.user) {
|
||||||
try {
|
try {
|
||||||
const res = await fetch(serverEndpoint + videoUrl, {
|
const res = await fetch(serverEndpoint + videoUrl, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: 'bearer ' + $session.user.accessToken,
|
Authorization: 'bearer ' + $session.user.accessToken,
|
||||||
|
'Accept-Range': 'bytes',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
videoData = URL.createObjectURL(await res.blob());
|
videoData = URL.createObjectURL(await res.blob());
|
||||||
|
|
||||||
videoPlayerNode.src = videoData;
|
videoPlayerNode.src = videoData;
|
||||||
|
// videoPlayerNode.src = videoData + '#t=0,5';
|
||||||
|
|
||||||
videoPlayerNode.load();
|
videoPlayerNode.load();
|
||||||
|
|
||||||
videoPlayerNode.onloadeddata = () => {
|
videoPlayerNode.onloadeddata = () => {
|
||||||
console.log('first frame load');
|
console.log('first frame load');
|
||||||
};
|
};
|
||||||
|
|
||||||
videoPlayerNode.oncanplaythrough = () => {
|
videoPlayerNode.oncanplaythrough = () => {
|
||||||
console.log('can play through');
|
console.log('can play through');
|
||||||
};
|
};
|
||||||
|
|
||||||
videoPlayerNode.oncanplay = () => {
|
videoPlayerNode.oncanplay = () => {
|
||||||
console.log('can play');
|
console.log('can play');
|
||||||
videoPlayerNode.muted = true;
|
videoPlayerNode.muted = true;
|
||||||
|
@ -10,6 +10,13 @@ const config = {
|
|||||||
methodOverride: {
|
methodOverride: {
|
||||||
allowed: ['PATCH', 'DELETE'],
|
allowed: ['PATCH', 'DELETE'],
|
||||||
},
|
},
|
||||||
|
vite: {
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'xmlhttprequest-ssl': './node_modules/engine.io-client/lib/xmlhttprequest.js',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user