still doing work a lil maybe full blown in a few hours to days.
06/15/2025

still doing work a lil maybe full blown in a few hours to days.

Broadcast with more and be viewed on a webpage. Contribute to Jayson-Tolleson/Broadcast development by creating an account on GitHub.

from gevent import monkeymonkey.patch_all()import sslfrom flask_socketio import SocketIO, emitfrom flask import Flask, R...
06/14/2025

from gevent import monkey
monkey.patch_all()
import ssl
from flask_socketio import SocketIO, emit
from flask import Flask, Response, request, render_template, jsonify
from flask_cors import CORS
import subprocess
import os

app = Flask(__name__, static_folder='broadcastjs')
app.url_map.strict_slashes = False
CORS(app)
socketio = SocketIO(app, async_mode='gevent', cors_allowed_origins='*')
broadcaster_sid = None
viewers = {}
wine_proc = None
vnc_proc = None
route('/start', methods=['GET'])
def start_wine():
global wine_proc, vnc_proc

# Kill existing if running
if wine_proc:
wine_proc.terminate()
wine_proc.wait()
if vnc_proc:
vnc_proc.terminate()
vnc_proc.wait()

# Start WINE app in virtual display :99 using xvfb-run
wine_cmd = [
'xvfb-run', '-a', '--server-num=99',
'--server-args=-screen 0 1280x800x24',
'wine', os.path.expanduser('/var/www/ableton/Ableton.exe') # adjust to your path
]
wine_proc = subprocess.Popen(wine_cmd)

# Start x11vnc on display :99
vnc_cmd = ['x11vnc', '-display', ':99', '-forever', '-nopw', '-shared']
vnc_proc = subprocess.Popen(vnc_cmd)

return jsonify(status="WINE and VNC started")
route('/stop', methods=['GET'])
def stop_wine():
global wine_proc, vnc_proc

if wine_proc:
wine_proc.terminate()
wine_proc.wait()
if vnc_proc:
vnc_proc.terminate()
vnc_proc.wait()

return jsonify(status="Processes stopped")
on('connect')
def handle_connect():
print(f"Client connected: {request.sid}")on('disconnect')
def handle_disconnect():
global broadcaster_sid
print(f"Client disconnected: {request.sid}")
if request.sid == broadcaster_sid:
for viewer_id in viewers:
emit('disconnectPeer', request.sid, room=viewer_id)
broadcaster_sid = None
viewers.pop(request.sid, None)
broadcast_viewer_count()on('broadcaster')
def handle_broadcaster():
global broadcaster_sid
broadcaster_sid = request.sid
print("Broadcaster connected")
broadcast_viewer_count()on('watcher')
def handle_watcher():
viewers[request.sid] = True
if broadcaster_sid:
emit('watcher', request.sid, room=broadcaster_sid)
broadcast_viewer_count()on('offer')
def handle_offer(data):
emit('offer', {'id': request.sid, 'offer': data['offer']}, room=data['target'])on('answer')
def handle_answer(data):
emit('answer', {'id': request.sid, 'answer': data['answer']}, room=data['target'])on('ice-candidate')
def handle_ice_candidate(data):
emit('ice-candidate', {'id': request.sid, 'candidate': data['candidate']}, room=data['target'])
def broadcast_viewer_count():
if broadcaster_sid:
socketio.emit('viewerCount', {'count': len(viewers)}, room=broadcaster_sid)on('videoSettingsChanged')
def handle_video_settings_changed(data):
print("๐Ÿ“ก Video settings changed:", data)
emit('settingsBroadcast', data, broadcast=True)route('/')
def index():
broadcasthtml="""



JAY VISION Broadcaster


body {
background: #111;
color: ;
font-family: sans-serif;
margin: 0;
padding: 0;
text-align: center;
}
video {
width: 96%;
max-height: 40vh;
border-radius: 10px;
background: black;
}
select, button {
margin: 5px;
font-size: 16px;
padding: 10px;
width: 90%;
max-width: 400px;
}
{
font-size: 18px;
margin-top: 10px;
}







๐ŸŽฅ JAY VISION Broadcast
๐Ÿ‘๏ธ Viewers: 0






1080p
4K
6K



๐ŸŽฆ Camera
๐Ÿ–ฅ๏ธ Screen Share + Mic
๐Ÿ–ฅ๏ธ Screen Only


๐ŸŽค Mic:


๐Ÿ”Š Speaker:




๐Ÿ”„ Switch Camera
โ›ถ Fullscreen
โบ Start Recording
๐Ÿ“บ PiP Mode


Ableton Live via WINE
Start Ableton
Stop Ableton




async function start() {
await fetch('https://localhost:8082/start');
alert('Started WINE + VNC server');
}
async function stop() {
await fetch('https://localhost:8082/stop');
alert('Stopped WINE + VNC server');
}





'use strict';

const videoInput = document.getElementById('videoInput');
const cameraSelect = document.getElementById('cameraSelect');
const resolutionSelect = document.getElementById('resolutionSelect');
const streamModeSelect = document.getElementById('streamModeSelect');
const micSelect = document.getElementById('micSelect');
const speakerSelect = document.getElementById('speakerSelect');

const viewerCountDisplay = document.getElementById('viewerCount');
const switchCameraBtn = document.getElementById('switchCameraBtn');
const fullscreenBtn = document.getElementById('fullscreenBtn');
const recordBtn = document.getElementById('recordBtn');
const pipBtn = document.getElementById('pipBtn');

let stream = null;
let usingFront = true;
let currentDeviceId = null;
let audioDeviceId = null;

const socket = io();
const peerConnections = {};
const config = { iceServers: [{ urls: "stun:stun.l.google.com:19302" }], sdpSemantics: 'unified-plan' };

let isRecording = false;
let mediaRecorder;
let recordedChunks = [];

function getResConstraints() {
const val = resolutionSelect.value;
return val === '4k' ? { width: { ideal: 3840 }, height: { ideal: 2160 } } :
val === '6k' ? { width: { ideal: 6144 }, height: { ideal: 3160 } } :
{ width: { ideal: 1920 }, height: { ideal: 1080 } };
}

function stopStream() {
if (stream) {
stream.getTracks().forEach(t => t.stop());
stream = null;
}
}

async function setupStream() {
videoInput.srcObject = stream;

for (const id in peerConnections) {
const pc = peerConnections[id];
const senders = pc.getSenders();
stream.getTracks().forEach(track => {
const sender = senders.find(s => s.track?.kind === track.kind);
if (sender) sender.replaceTrack(track);
});
}
}

async function updateStreamSettingsAuto() {
stopStream();

const mode = streamModeSelect.value;
audioDeviceId = micSelect.value || null;

try {
if (mode === 'camera') {
const constraints = {
audio: audioDeviceId ? { deviceId: { exact: audioDeviceId } } : true,
video: {
facingMode: usingFront ? 'user' : 'environment',
deviceId: currentDeviceId ? { exact: currentDeviceId } : undefined,
...getResConstraints()
}
};
stream = await navigator.mediaDevices.getUserMedia(constraints);
} else if (mode === 'screen+mic') {
const screenStream = await navigator.mediaDevices.getDisplayMedia({ video: true, audio: true });
const micStream = await navigator.mediaDevices.getUserMedia({ audio: audioDeviceId ? { deviceId: { exact: audioDeviceId } } : true });

// Combine audio tracks from screen + mic
const audioContext = new AudioContext();
const destination = audioContext.createMediaStreamDestination();

if (screenStream.getAudioTracks().length) {
const screenSource = audioContext.createMediaStreamSource(screenStream);
screenSource.connect(destination);
}
const micSource = audioContext.createMediaStreamSource(micStream);
micSource.connect(destination);

const combinedStream = new MediaStream();
screenStream.getVideoTracks().forEach(track => combinedStream.addTrack(track));
destination.stream.getAudioTracks().forEach(track => combinedStream.addTrack(track));

stream = combinedStream;
} else if (mode === 'screen') {
stream = await navigator.mediaDevices.getDisplayMedia({ video: true });
}

await setupStream();
} catch (err) {
console.error('Error accessing media devices:', err);
alert(`Error accessing media devices:\n${err.name}: ${err.message}`);
videoInput.style.display = 'none';
viewerCountDisplay.insertAdjacentHTML('afterend',
`Camera/mic access is required for broadcasting.`);
}
}

function setVideoSink() {
if ('setSinkId' in videoInput) {
videoInput.setSinkId(speakerSelect.value).catch(e => console.warn('setSinkId error:', e));
}
}

// Event Handlers
switchCameraBtn.onclick = () => {
usingFront = !usingFront;
updateStreamSettingsAuto();
};

fullscreenBtn.onclick = () => {
videoInput.requestFullscreen?.();
};

pipBtn.onclick = async () => {
try {
if (document.pictureInPictureElement) {
await document.exitPictureInPicture();
} else {
await videoInput.requestPictureInPicture();
}
} catch (e) {
console.warn('PiP error:', e);
}
};

recordBtn.onclick = () => {
if (!stream) return alert("Start streaming first");
if (!MediaRecorder.isTypeSupported('video/webm')) return alert("Recording not supported in your browser");

if (!isRecording) {
recordedChunks = [];
mediaRecorder = new MediaRecorder(stream, { mimeType: 'video/webm; codecs=vp8,opus' });
mediaRecorder.ondataavailable = e => { if (e.data.size > 0) recordedChunks.push(e.data); };
mediaRecorder.onstop = () => {
const blob = new Blob(recordedChunks, { type: 'video/webm' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'recording.webm';
document.body.appendChild(a);
a.click();
setTimeout(() => {
URL.revokeObjectURL(url);
document.body.removeChild(a);
}, 100);
};
mediaRecorder.start();
recordBtn.textContent = 'โน Stop Recording';
isRecording = true;
} else {
mediaRecorder.stop();
recordBtn.textContent = 'โบ Start Recording';
isRecording = false;
}
};

// Populate Camera Select
async function getCameras() {
const devices = await navigator.mediaDevices.enumerateDevices();
cameraSelect.innerHTML = '';
devices.filter(d => d.kind === 'videoinput').forEach((device, i) => {
const option = document.createElement('option');
option.value = device.deviceId;
option.text = device.label || `Camera ${i + 1}`;
cameraSelect.appendChild(option);
});
if (cameraSelect.options.length > 0) {
currentDeviceId = cameraSelect.value = cameraSelect.options[0].value;
}
}

// Populate Mic and Speaker Selects
async function getAudioDevices() {
const devices = await navigator.mediaDevices.enumerateDevices();
micSelect.innerHTML = '';
speakerSelect.innerHTML = '';
devices.forEach(device => {
const option = document.createElement('option');
option.value = device.deviceId;
option.text = device.label || `${device.kind} ${device.deviceId.slice(-4)}`;
if (device.kind === 'audioinput') micSelect.appendChild(option);
if (device.kind === 'audiooutput') speakerSelect.appendChild(option);
});
}

micSelect.onchange = () => {
audioDeviceId = micSelect.value;
updateStreamSettingsAuto();
};

speakerSelect.onchange = () => {
setVideoSink();
};

cameraSelect.onchange = () => {
currentDeviceId = cameraSelect.value;
updateStreamSettingsAuto();
};

resolutionSelect.onchange = updateStreamSettingsAuto;
streamModeSelect.onchange = updateStreamSettingsAuto;

navigator.mediaDevices.ondevicechange = () => {
getCameras();
getAudioDevices();
};

// WebRTC Signaling Handlers
socket.emit('broadcaster');

socket.on('watcher', id => {
const pc = new RTCPeerConnection(config);
peerConnections[id] = pc;

if (stream) {
stream.getTracks().forEach(track => pc.addTrack(track, stream));
}

pc.onicecandidate = event => {
if (event.candidate) {
socket.emit('ice-candidate', { target: id, candidate: event.candidate });
}
};

pc.createOffer()
.then(offer => pc.setLocalDescription(offer))
.then(() => {
socket.emit('offer', { target: id, offer: pc.localDescription });
});
});

socket.on('answer', ({ id, answer }) => {
const pc = peerConnections[id];
if (pc) pc.setRemoteDescription(answer);
});

socket.on('ice-candidate', ({ id, candidate }) => {
const pc = peerConnections[id];
if (pc) pc.addIceCandidate(candidate);
});

socket.on('disconnectPeer', id => {
const pc = peerConnections[id];
if (pc) {
pc.close();
delete peerConnections[id];
}
});

socket.on('viewerCount', data => {
viewerCountDisplay.textContent = `๐Ÿ‘๏ธ Viewers: ${data.count}`;
});

// Initialize
async function init() {
await getAudioDevices();
await getCameras();
await updateStreamSettingsAuto();
}

document.addEventListener('DOMContentLoaded', init);





"""
return Response(broadcasthtml)
route('/watch')
def watch():
watchhtml="""



JAY VISION Viewer


html, body {
margin: 0;
padding: 0;
background-color: #000;
height: 100%;
overflow: hidden;
font-family: sans-serif;
}
video {
width: 100%;
height: auto;
max-height: 100vh;
background-color: black;
}
{
position: fixed;
top: 0; left: 0; right: 0; bottom: 0;
display: none;
align-items: center;
justify-content: center;
flex-direction: column;
background-color: rgba(0, 0, 0, 0.7);
color: white;
font-size: 1.5em;
z-index: 10;
text-align: center;
}
.spinner-pie {
width: 60px;
height: 60px;
border-radius: 50%;
background: conic-gradient(
0% 25%,
25% 50%,
50% 75%,
75% 100%
);
animation: spin 1.5s linear infinite;
margin-bottom: 1em;
}
spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}





๐Ÿ”„ Reconnecting to streamโ€ฆ





const video = document.getElementById('watcherVideo');
const overlay = document.getElementById('overlay');

let pc = null;
let streamSet = false;
let socket = null;
let connected = false;
let failureTimeout = null;

function showOverlay(message = '๐Ÿ”„ Reconnecting to streamโ€ฆ') {
overlay.style.display = 'flex';
overlay.querySelector('div:last-child').textContent = message;
}

function hideOverlay() {
overlay.style.display = 'none';
}

function connectSocket() {
if (socket) socket.disconnect();

socket = io({
reconnection: true,
reconnectionAttempts: Infinity,
reconnectionDelay: 2000,
reconnectionDelayMax: 5000,
});

socket.on('connect', () => {
connected = true;
streamSet = false;
hideOverlay();
clearTimeout(failureTimeout);
socket.emit('watcher');
});

socket.on('disconnect', () => {
connected = false;
showOverlay();
failureTimeout = setTimeout(() => location.reload(), 120000); // 2 min fallback
});

socket.on('offer', ({ id, offer }) => {
setupPeerConnection(id, offer);

setTimeout(() => {
if (!streamSet && connected) {
console.warn("No stream received, re-requesting...");
socket.emit('watcher');
}
}, 5000);
});

socket.on('ice-candidate', ({ candidate }) => {
if (pc) pc.addIceCandidate(new RTCIceCandidate(candidate)).catch(console.error);
});

socket.on('viewerCount', ({ count }) => {
console.log(`๐Ÿ‘ Viewer count: ${count}`);
});
}

function setupPeerConnection(id, offer) {
if (pc) {
pc.close();
pc = null;
streamSet = false;
}

pc = new RTCPeerConnection({
iceServers: [{ urls: "stun:stun.l.google.com:19302" }]
});

pc.ontrack = event => {
if (!streamSet) {
video.srcObject = event.streams[0];
streamSet = true;
hideOverlay();
}
};

pc.onicecandidate = event => {
if (event.candidate) {
socket.emit('ice-candidate', { target: id, candidate: event.candidate });
}
};

pc.onconnectionstatechange = () => {
if (['failed', 'disconnected', 'closed'].includes(pc.connectionState)) {
console.warn("PeerConnection state:", pc.connectionState);
showOverlay();
if (pc) pc.close();
pc = null;
streamSet = false;
if (connected) {
socket.emit('watcher');
}
}
};

pc.setRemoteDescription(new RTCSessionDescription(offer))
.then(() => pc.createAnswer())
.then(answer => pc.setLocalDescription(answer))
.then(() => {
socket.emit('answer', { target: id, answer: pc.localDescription });
})
.catch(console.error);
}

// Request fullscreen on first click
document.addEventListener('click', () => {
if (video.requestFullscreen) {
video.requestFullscreen();
} else if (video.webkitRequestFullscreen) {
video.webkitRequestFullscreen();
} else if (video.msRequestFullscreen) {
video.msRequestFullscreen();
}
}, { once: true });

// Cleanup on unload
window.onbeforeunload = () => {
if (socket) socket.close();
if (pc) pc.close();
};

connectSocket();




"""
return Response(watchhtml)
if __name__ == "__main__":
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
context.load_cert_chain('/var/security/fullchain.pem', '/var/security/privkey.pem')
socketio.run(app, debug=True, host='0.0.0.0', ssl_context=context, port=8082)

So i started making an os....I made an installer this is the broke code i will fix:   hopefully on some forum of debian ...
03/22/2025

So i started making an os....I made an installer this is the broke code i will fix: hopefully on some forum of debian or pi. or python.
Its DEBOOTSTRAP!!!!

#!/usr/bin/env python3
# # # # the isntaller(local)
import subprocess
from subprocess import PIPE, STDOUT
commands1 = ['sudo apt install python3 python3-flask python3-werkzeug python3-flask-socketio debootstrap binfmt-support qemu-user-static', '']
for command in commands1:
try:
subprocess.run(command, shell=True, check=True)
except subprocess.CalledProcessError as e:
print (f"An error occurred while running '{command}': {e}")
# # # # the installer on http://0.0.0.0/Install
from flask import Flask, Response, request, render_template, redirect, url_for
from werkzeug.utils import secure_filename
from flask_socketio import SocketIO, send, emit
app = Flask(__name__)
socketio = SocketIO(app)route('/out/')
def out(card):
card = '/dev/'+card
def output():
packages = 'linux-headers-6.12.19-current-bcm2711,linux-headers-current-bcm2712=24.2.1,openssh-server,ca-certificates,man-db,less,dbus,locales,task-gnome-desktop,lightdm,sddm,chromium-browser,pithos,pavucontrol,alsa*,pipewire-alsa,pipewire-alsa-dbgsym,pipewire-audio,pipewire-audio-client-libraries,pipewire-bin,pipewire-bin-dbgsym,pipewire-pulse,v4l2loopback-dkms,obs-plugins,obs-studio,xinput,gnome-shell,gnome-shell-common,gnome-shell-extensions,gnome-shell-extension-manager,libpipewire-0.3-*,gnome-remote-desktop,gnome-settings-daemon*,x11*,git,qgnomeplatform-qt5,qt5-image-formats-plugins,qt5-qmltooling-plugins,qtvirtualkeyboard-plugin,qttranslations5-l10n,libqt5svg5,qt5-gtk-platformtheme,qtwayland5,vulkan-tools,mesa-vulkan-drivers,xdg-desktop-portal-gnome,libspa-0.2-bluetooth,qv4l2,rpi-imager,gnome-tweaks'
yield """div {background: black;width: 50%;margin: 100px auto;color: white;border-radius: 1em;width: 1080px;height: 720px;overflow:hidden;overflow-x:hidden;-webkit-resize:vertical;-moz-resize:vertical;} iframe
{
width:1500px; /* set this to approximate width of entire page you're embedding */
height:1200px; /* determines where the bottom of the page cuts off */
margin-left:00px; /* clipping left side of page */
margin-top:0px; /* clipping top of page */
overflow:hidden;
/* resize seems to inherit in at least Firefox */
-webkit-resize:none;
-moz-resize:none;
resize:none;
}
nothing received yet...for var div = document.getElementById('data');
"""
p = subprocess.Popen("""sudo parted -a optimal """+card+""" mklabel gpt mkpart primary ntfs 0 100% primary ntfs 0 1G primary ext4 1G 100% quit && export SD_CARD="""+card+""" && export LUKS_MAPPER_ALIAS=pi01 && export ROOT_MOUNT=/mnt/rpi && export SD_CARD_FW=${"""+card+"""}1 && export SD_CARD_LUKS=${"""+card+"""}2 && sudo cryptsetup luksFormat -c aes-xts-plain -s 512 -i 100 --label PILUKS ${SD_CARD_LUKS} && sudo cryptsetup luksOpen ${SD_CARD_LUKS} ${LUKS_MAPPER_ALIAS} && sudo mkfs.vfat -F 32 -n PIBOOT ${SD_CARD_FW} && sudo mkfs.ext4 -L PIROOT /dev/mapper/${LUKS_MAPPER_ALIAS} && sudo mkdir -pv ${ROOT_MOUNT} && sudo mount -v /dev/mapper/${LUKS_MAPPER_ALIAS} ${ROOT_MOUNT} && sudo mkdir -pv ${ROOT_MOUNT}/boot/firmware && sudo mount -v ${SD_CARD_FW} ${ROOT_MOUNT}/boot/firmware && sudo debootstrap --arch=arm64 --foreign --components=main,non-free --variant=minbase --include=linux-image-arm64,systemd-sysv,raspi-firmware,cryptsetup,console-setup,net-tools,iproute2,udhcpd,"""+packages+""" --force-check-gpg buster ${ROOT_MOUNT} http://cdn-fastly.deb.debian.org/debian && sudo chroot ${ROOT_MOUNT} /debootstrap/debootstrap --second-stage && cd ${ROOT_MOUNT} && sudo echo '${LUKS_MAPPER_ALIAS} LABEL=PILUKS none luks' > etc/crypttab && sudo cat etc/apt/sources.list && mount -o bind /dev ${ROOT_MOUNT}/dev && mount -o bind /proc ${ROOT_MOUNT}/proc && mount -o bind /sys ${ROOT_MOUNT}/sys && sudo LANG=C chroot ${ROOT_MOUNT} /bin/bash && sudo update-initramfs -u && sudo systemctl enable systemd-networkd && sudo systemctl enable systemd-resolved && sudo passwd root && exit && sudo sed -i -e 's,/dev/mmcblk0p2,LABEL=PIROOT,' boot/firmware/cmdline.txt && sudo sed -i -e 's/console=ttyS1,115200 //' boot/firmware/cmdline.txt && cd / && umount -Rv ${ROOT_MOUNT} && sudo cryptsetup luksClose ${LUKS_MAPPER_ALIAS}""", shell=True, stdout=subprocess.PIPE, stderr=STDOUT)
while True:
out = ((p.stdout.readline()).strip())
out =str(out)
if out != "b''":
print (out)
yield """div.innerHTML = "OUTPUT: """+out+""" """"
return Response(output())route('/Install',methods = ['POST', 'GET'])
def start():
p = subprocess.Popen('ls -l /dev/sd*', shell=True, stdout=subprocess.PIPE, stderr=STDOUT)
out = ((p.stdout.readline()).strip())
out =str(out)
print (out)
if request.method == 'POST':
card = request.form['card']
return redirect(url_for('out',card=card))
else:
card=request.args.get('card')
return """body {background: ;} { text-align: center; }Raspberry Pi 5 Debian Gnome Installer!!!
OPTIONS: ...
Identify Your SD/Flash Card: """+out+"""
"""
if __name__ == "__main__":
print ('running Install server @ 0.0.0.0/Install Go there in browser.')
socketio.run(app, host='0.0.0.0', debug=True, port=80)

03/14/2025
03/12/2025
03/11/2025

I might buy a new/er Tacoma...IF i wait 1 yr they are electric like i want. so i fixed my drivability of tacoma with some cash n have to keep it for as long as possible, upto 14 mo......

Some right action here was tight to see in nostalgia from 20yrs ago now!
03/01/2025

Some right action here was tight to see in nostalgia from 20yrs ago now!

Address

Fullerton, CA
92831

Telephone

+16572934208

Website

https://lftr.biz/

Alerts

Be the first to know and let us send you an email when Jay T posts news and promotions. Your email address will not be used for any other purpose, and you can unsubscribe at any time.

Share