Skip to content

Instantly share code, notes, and snippets.

View NielsLeenheer's full-sized avatar

Niels Leenheer NielsLeenheer

View GitHub Profile
/**
* Detect if the browser can play MP3 audio using native HTML5 Audio.
* Invokes the callack function with first parameter is the boolean success
* value; if that value is false, a second error parameter is passed. This error
* is either HTMLMediaError or some other DOMException or Error object.
* Note the callback is likely to be invoked asynchronously!
* @param {function(boolean, Object|undefined)} callback
*/
function canPlayAudioMP3(callback){
try {
Consoles:
Xbox 360 - Internet Explorer 9
Xbox One - Internet Explorer 10
Sony PlayStation 3 - Netfront
Sony PlayStation 4 - Chromium based
Sony PlayStation TV - Netfront NX
Nintendo Wii - Opera 9.6, Presto
Nintendo Wii U - Netfront NX
@NielsLeenheer
NielsLeenheer / Sony
Last active May 24, 2017 22:35
Google Chrome on Sony devices
Sony devices ship with Google Chrome as the default browser. Google Chrome is baked
into the firmware of the device. Different versions of the firmware come with different
versions of Google Chrome.
Usually the version that comes with the firmware is updated using Google Play, however...
When first starting up the device Sony does not ask the user to log into Google Play.
This means that unless you manually open Google Play and log in, the devices does not
receive any updates using Google Play. In this case Google Chrome is only updated when
the user installs a firmware update.
@NielsLeenheer
NielsLeenheer / LG Browser
Last active May 24, 2017 22:35
LG Browser
Chromium 30
458 / 555
https://html5test.com/results/related/7c791b543cbd7705f547a0a30e5404cf.html
- G Pad 8.3 Android 4.4.2
- G Pro 2 Android 4.4.2
- G2 Android 4.4.2
- G2 mini Android 4.4.2
- L65 Android 4.4.2
- L70 Android 4.4.2
@NielsLeenheer
NielsLeenheer / HTC Sense Browser
Created February 4, 2015 13:03
HTC Sense Browser
Note: All versions of the HTC Sense browser listed below send the following header: X-Requested-With: com.htc.sense.browser
Note: The difference between the two WebKit based versions are mostly which form field types are supported
Webkit
368 / 555
https://html5test.com/results/related/127d2c84dc7e495a6ed4ddd8ceccac2a.html
@NielsLeenheer
NielsLeenheer / Duck.gltf
Last active August 1, 2017 20:20
WebGL / Three.js ducks
{
"asset": {
"generator": "COLLADA2GLTF",
"version": "2.0"
},
"scene": 0,
"scenes": [
{
"nodes": [
0
@NielsLeenheer
NielsLeenheer / screenmirror-puck.js
Last active April 4, 2020 12:13
Toggle screen-mirroring on the new MacBook Pro using a Puck.js
var kb = require("ble_hid_keyboard");
var services = {
0x180a: {
0x2a50: {
value: [
0x01, /* Use USB Vendor IDs */
0xac, 0x05, /* Apple */
0x5a, 0x02, /* Internal Keyboard */
0x00, 0x00
var kb = require("ble_hid_keyboard");
var services = {
0x180a: {
0x2a50: {
value: [
0x01, /* Use USB Vendor IDs */
0xac, 0x05, /* Apple */
0x5a, 0x02, /* Internal Keyboard */
0x00, 0x00
@NielsLeenheer
NielsLeenheer / geolocation.js
Last active June 22, 2020 15:02
Make navigator.geolocation.getCurrentPosition more reliable
(function() {
if (navigator.geolocation) {
function PositionError(code, message) {
this.code = code;
this.message = message;
}
PositionError.PERMISSION_DENIED = 1;
PositionError.POSITION_UNAVAILABLE = 2;
@NielsLeenheer
NielsLeenheer / Samsung Browser
Last active June 23, 2020 11:33
Samsung Browser
Note: Some older devices such as the Galaxy S III did not get the Chromium based browser with
the update to Android 4.2 or later. When Samsung later introduced the Galaxy S3 Neo it did get
the new browser.
Note: With the Android 4.3 release and version 1.5 of the Chromium browser, Samsung did not
enable WebAudio API for the Note 3. All other devices did get the WebAudio API.
Note: Samsung did not update the browser version with the upgrade from Android 4.3 to 4.4,
but did add getUserMedia and WebRTC functionality.