Skip to content

Instantly share code, notes, and snippets.

View benjaminmiles's full-sized avatar

Benjamin Miles benjaminmiles

View GitHub Profile
@benjaminmiles
benjaminmiles / ReactShareMedia.jsx
Last active February 20, 2024 17:09
Use the Web Share API to save and share a media file on supported mobile apps with a direct link fallback.
import React, { useCallback, useState, useEffect } from "react";
export async function mediaToBlob(src = "", mimetype = "video/mp4") {
// Fetch the media file as ArrayBuffer
const response = await fetch(src);
const mediaData = await response.arrayBuffer();
// Create a Blob from the video data
const blob = new Blob([mediaData], { type: mimetype });
@benjaminmiles
benjaminmiles / Low Poly Three.js Mountain Scene.markdown
Created August 25, 2015 17:29
Low Poly Three.js Mountain Scene
@benjaminmiles
benjaminmiles / Angry Bossman V2 Phaser Game.markdown
Created August 25, 2015 17:27
Angry Bossman V2 Phaser Game