mirror of
https://git.j0bot.ch/admin_j0bot/ploxion-record.git
synced 2026-11-29 07:05:10 +00:00
synchro du labo (0bf0da65) : app.blade.php, README.md
This commit is contained in:
commit
2c4c5646c7
21
README.md
Normal file
21
README.md
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# ⏺ Record
|
||||||
|
|
||||||
|
Enregistre un tsoin : caméra, écran ou micro → vidéo .webm (MediaRecorder). 100% local.
|
||||||
|
|
||||||
|
| | |
|
||||||
|
| --- | --- |
|
||||||
|
| id | `record` |
|
||||||
|
| fournit | `record-video` `record-screen` `record-audio` `tsoin` |
|
||||||
|
| bions qu'il nomme | `jOSApps` |
|
||||||
|
| fichiers | `app.blade.php` |
|
||||||
|
| dans le labo | `resources/views/ploxions/record/` (dépôt `my_website2`) |
|
||||||
|
|
||||||
|
## Contribuer
|
||||||
|
|
||||||
|
- **Dans le xer** : https://labo.j0bot.ch/px/atelier?ploxion=record — prends-le, modifie-le, vois-le tourner, « ⧗ envoyer le tsoin ».
|
||||||
|
- **Dans VS Code** : `xb prendre record` (ou l'extension xerboxion › ⇩ Prendre), puis ⧗ Envoyer.
|
||||||
|
- Le chemin complet : https://labo.j0bot.ch/px/contribuer
|
||||||
|
|
||||||
|
Ce dépôt est un **miroir** du labo (synchronisé par `bin/ploxions-forge.mjs`, depuis le commit `0bf0da65`) : une modif se propose par un tsoin ou une branche du labo, pas directement ici.
|
||||||
|
|
||||||
|
© 2026 chill-tekk · ne pas nuire
|
||||||
88
app.blade.php
Normal file
88
app.blade.php
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
{{-- PL0XION RECORD — enregistreur (caméra / écran / micro) → un tsoin. 100% client-side
|
||||||
|
(getUserMedia / getDisplayMedia + MediaRecorder). Débloqué par Permissions-Policy
|
||||||
|
camera/microphone/display-capture = self. S'enregistre dans window.jOSApps['record']. --}}
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
var LIVE = null; // posé au mount : { src, recording }
|
||||||
|
function describe() {
|
||||||
|
var src = LIVE ? LIVE.src() : null, rec = LIVE ? LIVE.recording() : false;
|
||||||
|
return { v: 1, id: 'record', title: 'Record', icon: '⏺', items: [
|
||||||
|
{ p: 1, kind: 'stat', label: rec ? '● enregistrement' : '○ arrêté', value: src || 'aucune source' }
|
||||||
|
] };
|
||||||
|
}
|
||||||
|
function mount(el) {
|
||||||
|
el.innerHTML =
|
||||||
|
'<style>'
|
||||||
|
+ '.rec{display:flex;flex-direction:column;height:100%;font-family:var(--xr-font-ui,system-ui);color:var(--xr-text,#e7f0ff);background:var(--xr-bg,#0b1220);padding:12px;gap:10px}'
|
||||||
|
+ '.rec-src{display:flex;gap:8px;flex-wrap:wrap}'
|
||||||
|
+ '.rec-src button,.rec-ctl button{background:color-mix(in srgb,var(--xr-accent,#3fe0d0) 14%,transparent);color:var(--xr-text,#e7f0ff);border:1px solid var(--xr-border,#22324f);border-radius:10px;padding:8px 12px;cursor:pointer;font:13px system-ui}'
|
||||||
|
+ '.rec-src button.on{background:var(--xr-accent,#3fe0d0);color:#08101e;font-weight:700}'
|
||||||
|
+ '.rec-ctl{display:flex;gap:8px;align-items:center}'
|
||||||
|
+ '.rec-ctl .go{background:var(--xr-accent2,#f233b3)!important;color:#fff!important;border:none!important}'
|
||||||
|
+ '.rec-prev{flex:1;min-height:0;width:100%;background:#000;border-radius:12px;border:1px solid var(--xr-border,#22324f);object-fit:contain}'
|
||||||
|
+ '.rec-msg{font-size:.8rem;color:var(--xr-muted,#8aa0c0)}'
|
||||||
|
+ '.rec-out a{color:var(--xr-accent,#3fe0d0)}'
|
||||||
|
+ '@media (max-width:768px){'
|
||||||
|
+ '.rec{height:auto;min-height:100%}'
|
||||||
|
+ '.rec-prev{flex:none;height:38vh;max-height:38vh}'
|
||||||
|
+ '}'
|
||||||
|
+ '</style>'
|
||||||
|
+ '<div class="rec">'
|
||||||
|
+ ' <div class="rec-src">'
|
||||||
|
+ ' <button data-src="camera">🎥 Caméra</button>'
|
||||||
|
+ ' <button data-src="screen">🖥 Écran</button>'
|
||||||
|
+ ' <button data-src="mic">🎙 Micro seul</button>'
|
||||||
|
+ ' </div>'
|
||||||
|
+ ' <video class="rec-prev" data-prev autoplay muted playsinline></video>'
|
||||||
|
+ ' <div class="rec-ctl">'
|
||||||
|
+ ' <button class="go" data-go disabled>● Enregistrer</button>'
|
||||||
|
+ ' <button data-stop disabled>■ Stop</button>'
|
||||||
|
+ ' <span class="rec-msg" data-msg>Choisis une source.</span>'
|
||||||
|
+ ' </div>'
|
||||||
|
+ ' <div class="rec-out" data-out></div>'
|
||||||
|
+ '</div>';
|
||||||
|
|
||||||
|
var prev=el.querySelector('[data-prev]'), msg=el.querySelector('[data-msg]'),
|
||||||
|
go=el.querySelector('[data-go]'), stop=el.querySelector('[data-stop]'), out=el.querySelector('[data-out]');
|
||||||
|
var stream=null, rec=null, chunks=[], src=null;
|
||||||
|
|
||||||
|
function stopStream(){ if(stream){ stream.getTracks().forEach(function(t){t.stop();}); stream=null; } }
|
||||||
|
function pick(s){
|
||||||
|
stopStream(); src=s; out.innerHTML='';
|
||||||
|
el.querySelectorAll('[data-src]').forEach(function(b){ b.classList.toggle('on', b.dataset.src===s); });
|
||||||
|
var p;
|
||||||
|
if(s==='camera') p=navigator.mediaDevices.getUserMedia({video:{facingMode:'user'},audio:true});
|
||||||
|
else if(s==='screen') p=navigator.mediaDevices.getDisplayMedia({video:true,audio:true});
|
||||||
|
else p=navigator.mediaDevices.getUserMedia({audio:true,video:false});
|
||||||
|
if(!navigator.mediaDevices){ msg.textContent='getUserMedia indisponible (besoin HTTPS).'; return; }
|
||||||
|
msg.textContent='Autorise l\'accès dans le navigateur…';
|
||||||
|
p.then(function(st){ stream=st; prev.srcObject=st; prev.muted=true; go.disabled=false; msg.textContent='Prêt. ● pour enregistrer.'; })
|
||||||
|
.catch(function(err){ msg.textContent='Refusé / erreur : '+err.name+'. (autorise la caméra/écran dans le navigateur)'; go.disabled=true; });
|
||||||
|
}
|
||||||
|
el.querySelectorAll('[data-src]').forEach(function(b){ b.addEventListener('click',function(){ pick(b.dataset.src); }); });
|
||||||
|
|
||||||
|
go.addEventListener('click', function(){
|
||||||
|
if(!stream) return;
|
||||||
|
chunks=[]; out.innerHTML='';
|
||||||
|
try{ rec=new MediaRecorder(stream); }catch(e){ msg.textContent='MediaRecorder indispo : '+e.message; return; }
|
||||||
|
rec.ondataavailable=function(e){ if(e.data.size) chunks.push(e.data); };
|
||||||
|
rec.onstop=function(){
|
||||||
|
var blob=new Blob(chunks,{type:chunks[0]&&chunks[0].type||'video/webm'});
|
||||||
|
var url=URL.createObjectURL(blob);
|
||||||
|
out.innerHTML='<div class="rec-msg">tsoin enregistré ('+(blob.size/1048576).toFixed(1)+' Mo) — '
|
||||||
|
+'<a download="tsoin-'+Date.now()+'.webm" href="'+url+'">télécharger</a></div>';
|
||||||
|
msg.textContent='Arrêté.';
|
||||||
|
};
|
||||||
|
rec.start(); go.disabled=true; stop.disabled=false; msg.textContent='● Enregistrement…';
|
||||||
|
});
|
||||||
|
stop.addEventListener('click', function(){ if(rec&&rec.state!=='inactive') rec.stop(); go.disabled=false; stop.disabled=true; });
|
||||||
|
|
||||||
|
LIVE = { src: function () { return src; }, recording: function () { return !!(rec && rec.state === 'recording'); } };
|
||||||
|
// droit au silence : coupe la caméra/écran quand la fenêtre se ferme
|
||||||
|
return { unmount: function(){ LIVE = null; if(rec&&rec.state!=='inactive') rec.stop(); stopStream(); } };
|
||||||
|
}
|
||||||
|
|
||||||
|
window.jOSApps = window.jOSApps || {};
|
||||||
|
window.jOSApps['record'] = { manifest:{ id:'record', name:'Record', icon:'⏺' }, mount: mount, describe: describe };
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user