IndexedDB video binary file is corrupt - javascript

I'm saving a bunch of videos to IndexedDB, then displaying them again for an offline version of an app. I have an issue however where occasionally one blob video file will become corrupt. My investigation so far has revealed:
the video file is not corrupt because it's been re-rendered and is rendered in the same way as the other videos
the issue is when saving to the DB rather than retrieving from the DB
the issue occurs when running through both my local server and a remote server, it happens on the remote server more however
the issue seems to happen randomly i.e. I do not change any other variables to cause this issue
So I'm a bit stuck now, anyone have any ideas as to what the problem may be?
Thanks in advance :)

IndexedDB is not intended for storing big files and that is root of the problem. One direction where you can take a look is the file system API, unfortunately this API only works in Chrome (Nov 2014).

Related

Audio delay cycling through JavaScript object array?

This is my website hosted by netlify all is good except when I try to cycle through this array of objects I get an initial lag in my audio the code that plays the audio is "audio.play()" of .5-2 sec.
And after I have cycled through them once the lag almost all completely disappears is this a netlify thing?
On my localhost is works like in the movies so perfect!
Would love to get a helpful link/video/advice, thanks.
https://csgo-weapons.netlify.app/
It isn't a Netlify thing in particular, just an internet thing in general.
File loading isn't instantaneous on the web. When someone requests a file (in this case, the gun sound), it needs to get from the server to the client, and that takes some time (depending on things like network speeds, physical distance, etc.). On your local machine, these loading times are negligible, since the files are not traveling over the web.
After a file is loaded it's cached in the browser, which is why you're noticing no delay after cycling through all the guns.
A method to mitigate this issue would be to request and load all the sound files before the user starts cycling through all of the guns. That way, they don't need to be requested one-at-a-time on-demand. You could also try to reduce filesizes, although that won't help as much as the preloading.

How do I make a chrome extension that will take the current webpage and upload it to my custom domain via FTP so I can view it on a phone?

Overview
I am trying to make a Chrome Extension that takes the currently open html page and all its dependencies (CSS, JS) and uploads it to a custom domain via FTP. I would then be able to open it on my phone to make sure the website looks good on a phone.
Basically, I am trying to replicate the VSCode extension Live Server's functionality, but with it uploading the file to a custom domain. I know you'd normally be able to access live server's locally hosted server from a phone, but my university's internet setup doesn't seem to allow for this, hence my desire for an extension like this.
All I know about my hosting service is that it uses cPanel and supports FTP, which I assume is all I need. I can set up new FTP connections and logins. All the FTP details in the code will be hardcoded, but drawn from a separate file and .gitignored so they aren't in my commit history, which I hope is enough.
What I've Tried & What I'm Stuck On
I have most of the chrome extension stuff figured out; The FTP transfer process is what's giving me issues.
I first tried using chrome-app-ftp, but quickly realized that was old and was running into issues, so I switched to jsftp.
I used browserify to fix the "require" issue, and that cleared up some stuff.
I'm currently stuck on the following bug:
Error: TypeError: createConnection is not a function
I've done my research, and I do not think the error is because of an issue in my code; I believe that it is just a limitation of the tools I am using. This seems to be an issue with front-end JS not supporting the "net" module, which brings me to my question.
My Question
How do I circumvent my lack of support for the "net" module in the front-end? Do I need to set up some sort of local back-end for this with node or something like that? I have basically zero experience with anything back-end, so I might need pointed towards what sort of back-end is best for this. I more just need to know which tech stack is best for doing this.
If additional information is necessary I'll be checking back frequently and happy to help. Thanks in advance.

Is it possible to access a local file from a browser on a mobile device?

Question:
Let's say I create an android game that saves a save file(in the form of a text file) on the local android internal storage and I know the absolute path where the file is saved. Is it possible to create a website with a built in script that retrieves this textfile and displays the save data to the user? If not, why and are there any unconventional ways to get around it?
From my own research, I have seen similar topics give pretty mixed results. Some say that the browser is sandboxed, while others say that it's now possible. Any clarification would be appreciated! Thanks in advance!
It may be possible if you have a local web server running on your Android Device. If you can save the file to the Web Server Document folder, you can then access the file from your browser. I haven't tried it, but it sounds logically possible.

Temporarily store audio file with JavaScript

I'm currently building a web application that requires a fairly large audio file (~50mb) to be accessible offline.
I attempted this with fetching a base64 string of the audio file from the web server, then modifying the DOM by adding an audio element that points to the base64 string with using data:. However, this does not work in Chrome for Android; due to this bug.
I'm wondering if there's a better solution to the problem that works on Chrome for Android.
Thanks in advance.

Mobile Browser (iPad/iPhone/iPod/Android) crashes when updating image continuously javascript

we are trying to update the image src with base64 string using data URIs on our webpage every second with Java Script.
Java Script(AJAX) gets the latest image from webserver.
But all mobile browsers crashing after 5-10 mins. crash dump says, browser is crashing because of low memory.
is there any way to cleanup the memory programatically.
thanks in Advance.
Regards,
Kartheek
I haven't tested this myself but according to a comment on this webpage:
cubiq.org/testing-memory-usage-on-mobile-safari
base64 string images are not properly garbage collected by MobileSafari, causing MobileSafari to crash at what seems random places. I think it's worth trying to use regular image links and see what happens.
Also keep in mind that there is an image data memory limit around 10M.

Categories

Resources