canvasframework 0.5.12 → 0.5.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/CanvasFramework.js +24 -3
- package/index.js +1 -1
- package/package.json +1 -1
package/core/CanvasFramework.js
CHANGED
|
@@ -1932,16 +1932,37 @@ class CanvasFramework {
|
|
|
1932
1932
|
// ✅ OPTIONNEL : Marquer les composants comme "dirty" pour forcer le rendu
|
|
1933
1933
|
this._maxScrollDirty = true;
|
|
1934
1934
|
|
|
1935
|
-
|
|
1935
|
+
// ✅ ARRÊTER LES CAMÉRAS DES ANCIENS COMPOSANTS
|
|
1936
|
+
oldComponents.forEach(comp => {
|
|
1936
1937
|
// Vérifier si c'est un composant caméra
|
|
1937
|
-
if (comp.constructor.name === 'FloatedCamera' ||
|
|
1938
|
+
if (comp.constructor.name === 'FloatedCamera' ||
|
|
1939
|
+
comp.constructor.name === 'Camera' ||
|
|
1940
|
+
comp.constructor.name === 'QRCodeReader') {
|
|
1938
1941
|
// Arrêter le stream vidéo
|
|
1939
1942
|
if (comp.stopCamera && typeof comp.stopCamera === 'function') {
|
|
1940
1943
|
comp.stopCamera();
|
|
1941
|
-
console.log(`🎥 Caméra ${comp.constructor.name} arrêtée avant navigation`);
|
|
1942
1944
|
}
|
|
1943
1945
|
}
|
|
1944
1946
|
});
|
|
1947
|
+
|
|
1948
|
+
// ✅ NOUVEAU : Vérifier si la nouvelle route contient des composants caméra
|
|
1949
|
+
const hasCamera = this.components.some(comp =>
|
|
1950
|
+
comp.constructor.name === 'FloatedCamera' ||
|
|
1951
|
+
comp.constructor.name === 'Camera' ||
|
|
1952
|
+
comp.constructor.name === 'QRCodeReader'
|
|
1953
|
+
);
|
|
1954
|
+
|
|
1955
|
+
// Si la nouvelle route N'A PAS de caméra, nettoyer toutes les vidéos après 3 secondes
|
|
1956
|
+
if (!hasCamera) {
|
|
1957
|
+
console.log('⏰ Nettoyage des vidéos programmé dans 3 secondes...');
|
|
1958
|
+
setTimeout(() => {
|
|
1959
|
+
const videos = document.querySelectorAll('video');
|
|
1960
|
+
videos.forEach(v => v.remove());
|
|
1961
|
+
}, 3000);
|
|
1962
|
+
} else {
|
|
1963
|
+
console.log('📹 Route avec caméra détectée, pas de nettoyage automatique');
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1945
1966
|
}
|
|
1946
1967
|
|
|
1947
1968
|
/**
|
package/index.js
CHANGED