- Copy gopro_timer.html to the root directory on your SD card
- Enable WiFi on your GoPro
- Connect to your gopro WiFi from your computer
- Open http://10.5.5.9/videos/gopro_timer.html
Last active
November 21, 2015 13:38
-
-
Save nLight/522c104a2be1241564d1 to your computer and use it in GitHub Desktop.
GoPro Timer Proof of Concept
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>GoPro Timer</title> | |
</head> | |
<body> | |
<script> | |
var countDownTimer = null; | |
function countDown (time) { | |
stopTimer(); | |
var timer = document.getElementById("timer"); | |
timer.innerText = time--; | |
countDownTimer = window.setInterval(function () { | |
if (time > 0) { | |
timer.innerText = time--; | |
} | |
else { | |
stopTimer(); | |
} | |
}, 1000); | |
} | |
function stopTimer () { | |
clearInterval(countDownTimer); | |
document.getElementById("timer").innerText = ""; | |
} | |
function start () { | |
var startReq = new XMLHttpRequest() | |
, stopReq = new XMLHttpRequest() | |
, waitTime = parseInt( document.getElementById("waitTime").value, 10) | |
, recordTime = parseInt( document.getElementById("recordTime").value, 10) | |
, stopRecording = function () { | |
stopTimer(); | |
document.getElementById("cameraStatus").innerText = "Stopped..."; | |
stopReq.open("GET", "http://10.5.5.9/gp/gpControl/command/shutter?p=0"); | |
stopReq.send(); | |
} | |
, startRecording = function () { | |
startReq.open("GET", "http://10.5.5.9/gp/gpControl/command/shutter?p=1"); | |
startReq.addEventListener("load", function () { | |
document.getElementById("cameraStatus").innerText = "Recording..."; | |
countDownTimer = countDown(recordTime); | |
window.setTimeout(stopRecording, recordTime * 1000); | |
}); | |
startReq.send(); | |
}; | |
window.setTimeout(startRecording, waitTime * 1000); | |
countDown(waitTime); | |
} | |
</script> | |
<label for="waitTime">Wait time in sec: <input id="waitTime" value="5"></label> | |
<label for="recordTime">Record time in sec: <input id="recordTime" value="5"></label> | |
<button onclick="start();">Start!</button> | |
<div id="cameraStatus"></div> | |
<div id="timer"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment