Skip to content

Instantly share code, notes, and snippets.

@scottgwald
Last active August 29, 2015 13:57
Show Gist options
  • Save scottgwald/9579887 to your computer and use it in GitHub Desktop.
Save scottgwald/9579887 to your computer and use it in GitHub Desktop.
[wearscript] WearDiary2
<html style="width:100%; height:100%; overflow:hidden">
<head>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
<script>
var videoLength = 10;
var videoInterval = 300;
function recordVideo() {
WS.wake();
WS.activityCreate();
WS.say("Cheese");
WSRAW.recordWSVideo(videoLength);
setTimeout(function() {
WS.activityDestroy();
}, 1000);
// WS.activityDestroy();
queueVideo();
}
function queueVideo() {
setTimeout(function() {
var today = new Date();
var hours = today.getHours();
var minutes = today.getMinutes();
var seconds = today.getSeconds();
console.log("Calling recordWSVideo() " + hours + ":" + minutes + ":" + seconds);
WS.say("Please");
recordVideo();
}, videoInterval * 1000);
}
function main() {
if (WS.scriptVersion(1)) return;
ctx = document.getElementById('canvas').getContext("2d");
WS.say("Starting Wear Diary. Interval is " + videoInterval + " seconds");
recordVideo();
}
window.onload = main;
</script>
</body>
</html>
{
"name": "WearDiary2"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment