How can Meteor apps work offline?

Yes! This is already implemented in Meteor, for the most part. If the connection to the server is lost, the client can still function locally. Database writes will appear to succeed on the client and reflect instantly on the screen. Once the connection is re-established Meteor will re-send all the pending method requests to the … Read more

Detect if the internet connection is offline?

Almost all major browsers now support the window.navigator.onLine property, and the corresponding online and offline window events. Run the following code snippet to test it: console.log(‘Initially ‘ + (window.navigator.onLine ? ‘on’ : ‘off’) + ‘line’); window.addEventListener(‘online’, () => console.log(‘Became online’)); window.addEventListener(‘offline’, () => console.log(‘Became offline’)); document.getElementById(‘statusCheck’).addEventListener(‘click’, () => console.log(‘window.navigator.onLine is ‘ + window.navigator.onLine)); <button id=”statusCheck”>Click … Read more

Android: Speech Recognition without using google server

We used to recommend pocketsphinx, but now more advanced technology based on Kaldi toolkit is available. The demo is here: Vosk API, you can simply load it in Android Studio and run. Full disclosure: I am the primary author of Vosk. It supports speech recognition in 7 major languages – English, Chinese, Spanish, Portuguese, German, … Read more

WebView load website when online, load local file when offline

That sounds like a simple webview caching mechanism to me. The following should do what you are looking for: WebView webView = new WebView( context ); webView.getSettings().setAppCacheMaxSize( 5 * 1024 * 1024 ); // 5MB webView.getSettings().setAppCachePath( getApplicationContext().getCacheDir().getAbsolutePath() ); webView.getSettings().setAllowFileAccess( true ); webView.getSettings().setAppCacheEnabled( true ); webView.getSettings().setJavaScriptEnabled( true ); webView.getSettings().setCacheMode( WebSettings.LOAD_DEFAULT ); // load online by default … Read more

How to detect online/offline event cross-browser?

Currently in 2011, the various browser vendors cannot agree on how to define offline. Some browsers have a Work Offline feature, which they consider separate to a lack of network access, which again is different to internet access. The whole thing is a mess. Some browser vendors update the navigator.onLine flag when actual network access … Read more

Play local (hard-drive) video file with HTML5 video tag?

It is possible to play a local video file. <input type=”file” accept=”video/*”/> <video controls autoplay></video> When a file is selected via the input element: ‘change’ event is fired Get the first File object from the input.files FileList Make an object URL that points to the File object Set the object URL to the video.src property … Read more

Offline Speech Recognition In Android (JellyBean)

Google did quietly enable offline recognition in that Search update, but there is (as yet) no API or additional parameters available within the SpeechRecognizer class. {See Edit at the bottom of this post} The functionality is available with no additional coding, however the user’s device will need to be configured correctly for it to begin … Read more