Skip to content

Commit

Permalink
Use mobile video record for Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
collidingScopes authored Aug 5, 2024
1 parent 1af7834 commit e1bcfa6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions kaleidoscope.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,23 @@ var loadingScreen = document.getElementById("coverScreen");
//detect user browser
var ua = navigator.userAgent;
var isSafari = false;
var isFirefox = false;
var isIOS = false;
var isAndroid = false;
if(ua.includes("Safari")){
isSafari = true;
}
if(ua.includes("Firefox")){
isFirefox = true;
}
if(ua.includes("iPhone") || ua.includes("iPad") || ua.includes("iPod")){
isIOS = true;
}
if(ua.includes("Android")){
isAndroid = true;
}
console.log("isSafari: "+isSafari+", isIOS: "+isIOS+", isAndroid: "+isAndroid);
console.log("isSafari: "+isSafari+", isFirefox: "+isFirefox+", isIOS: "+isIOS+", isAndroid: "+isAndroid);


//video recording function
var recordBtn = document.getElementById("recordVideoButton");
Expand Down Expand Up @@ -117,7 +122,7 @@ function getUserInputs(){
maxImageWidth = Math.ceil(canvasWidth/numTiles); //could be tweaked for custom output dimensions

speedInputValue = Number(animationSpeedInput.value);
animationSpeed = 8000/speedInputValue * (numTiles/2); //larger value gives slower animation
animationSpeed = 8000/speedInputValue * (numTiles/2.5); //larger value gives slower animation
console.log("animation speed: "+animationSpeed);
videoDuration = Math.max(1,Math.min(60,Number(videoDurationInput.value)));
console.log("video record duration (seconds): "+videoDuration);
Expand Down Expand Up @@ -440,7 +445,7 @@ document.addEventListener('keydown', function(event) {
});

function chooseRecordingFunction(){
if(isIOS || isAndroid){
if(isIOS || isAndroid || isFirefox){
startMobileRecording();
}else {
recordVideoMuxer();
Expand Down

0 comments on commit e1bcfa6

Please sign in to comment.