Skip to content

Commit

Permalink
added new placeholders, improved QR templates and tweaked animations
Browse files Browse the repository at this point in the history
  • Loading branch information
iShineGuy authored and iShineGuy committed Feb 12, 2018
1 parent 5d939d0 commit d965800
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion amd/build/anim_fbars.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion amd/build/anim_hwave.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion amd/build/media_refresher.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion amd/build/poodll_goldmediaskin.min.js

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion amd/src/media_refresher.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ define(['jquery','core/log'], function($, log) {

should_be_checked: function(filename){
//check this is an unconverted recording that we need to track

//log.debug('mediaduration: ' + this.mediaduration);
//log.debug('placeholderduration: ' + this.placeholderduration);
//log.debug('fixed to one mediaduration: ' + parseFloat(this.mediaduration).toFixed(1));
//log.debug('fixed to one placeholderduration: ' + parseFloat(this.placeholderduration).toFixed(1));

//if any of these numbers is not numeric we kill it
if(!$.isNumeric(this.placeholderduration)){return false;}
Expand All @@ -49,7 +52,7 @@ define(['jquery','core/log'], function($, log) {
check_updates: function(filename,checktype){
//checktype:firstpass - if have a task then we keep checking till there is no task
//then we know its finished. Those checks are the 'secondpass'

this.should_be_checked(filename);
//check this is a recording that we need to track
if(checktype=='firstpass' && !this.should_be_checked(filename)){
return;
Expand Down
4 changes: 2 additions & 2 deletions classes/filtertools.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ public static function fetch_filter_properties_fromurl($link,$ext, $is_webservic
$proparray['TITLE'] = $title;
$proparray['FILEEXT'] = $ext;
//hardcoding for now, later we will do something better
$proparray['AUDIOPLACEHOLDERDURATION'] = 6.138;
$proparray['VIDEOPLACEHOLDERDURATION'] = 10.28644;
$proparray['AUDIOPLACEHOLDERDURATION'] = 4.362449;// as reported by firefox: 4.388496
$proparray['VIDEOPLACEHOLDERDURATION'] = 4.202812;//as reported by firefox: 4.202811
return $proparray;
}//end of function

Expand Down
8 changes: 5 additions & 3 deletions classes/poodlltools.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ class poodlltools
{
const LOG_SAVE_PLACEHOLDER_FAIL = 1;
const LOG_NOTHING_TO_TRANSCODE = 2;

const AUDIO_PLACEHOLDER_HASH ='e118549e4fc88836f418b6da6028f1fec571cd43';
const VIDEO_PLACEHOLDER_HASH ='c2a342a0a664f2f1c4ea5387554a67caf3dd158e';

const AUDIO_PLACEHOLDER_HASH ='805daf96c0b5e197a728f230d9550e9ba49e5ea7';
const VIDEO_PLACEHOLDER_HASH ='4eab92af4205d642e774718c85d5ea3a19881ba6';
const AUDIO_PLACEHOLDER_HASH_OLD ='e118549e4fc88836f418b6da6028f1fec571cd43';
const VIDEO_PLACEHOLDER_HASH_OLD ='c2a342a0a664f2f1c4ea5387554a67caf3dd158e';

//this is just a temporary function, until the PoodLL filter client plugins are upgraded to not use simpleaudioplayer
public static function fetchSimpleAudioPlayer($param1='auto',$url,$param3='http',$param4='width', $param5='height'){
Expand Down
Binary file modified convertingmessage.mp3
Binary file not shown.
Binary file modified convertingmessage.mp4
Binary file not shown.
2 changes: 1 addition & 1 deletion presets/qrtextreader.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"name":"QR Text Reader","key":"qrtextreader","version":"1.0.0","instructions":"Reads text encoded in QR codes aloud\n","showatto":"1","showplayers":"0","requirecss":"","requirejs":"/filter/poodll/amd/src/poodll_qrscanner.js","shim":"","defaults":"width=320,height=240","amd":"1","body":"<div style=\"width: @@width@@px\"><button type=\"button\" id=\"@@AUTOID@@_button\" style=\"margin: auto;\"><i class=\"fa fa-qrcode\"></i></button>\n</div>\n<video id=\"@@AUTOID@@\" width=\"@@width@@px\" height=\"@@height@@px\" class=\"hide\" playsinline></video>\n<audio id=\"@@AUTOID@@_player\" src=\"\"></audio>\n</div>","bodyend":"","script":"var qrs= requiredjs_qrtextreader;\nvar poodllfilelib = M.cfg.wwwroot + '/filter/poodll/poodllfilelib.php?datatype=speaktext&paramone=';\nvar thecam=$('#' + @@AUTOID@@);\nvar thebutton=$('#' + @@AUTOID@@ + '_button');\nvar theplayer=$('#' + @@AUTOID@@ + '_player');\n\nthebutton.click(function(){\n var pp = theplayer[0].play();\nif (pp !== undefined) {\n pp.then(function() {\n console.log('playing');\n }).catch(function(error) {\n console.log('error');\n });\n}\n qrs.startWebCam('' + @@AUTOID@@);\n qrs.setCallback(function(data){\n console.log(data);\n var src = poodllfilelib+encodeURI(data);\n theplayer.attr('src',src);\n var pp = theplayer[0].play();\n if (pp !== undefined) {\n pp.then(function() {\n console.log('playing');\n }).catch(function(error) {\n console.log('error');\n });\n}\n qrs.startScan('' + @@AUTOID@@);\n});\n\n qrs.startScan('' + @@AUTOID@@);\n thecam.show();\n});\n\n ","style":"","dataset":"","datasetvars":"","alternate":"","alternateend":""}
{"name":"QR Text Reader","key":"qrtextreader","version":"1.0.1","instructions":"Reads text encoded in QR codes aloud\n","showatto":"1","showplayers":"0","requirecss":"","requirejs":"/filter/poodll/amd/src/poodll_qrscanner.js","shim":"","defaults":"width=320,height=240","amd":"1","body":"<div style=\"width: @@width@@px\"><button type=\"button\" id=\"@@AUTOID@@_button\" style=\"margin: auto;\"><i class=\"fa fa-qrcode\"></i></button>\n</div>\n<video id=\"@@AUTOID@@\" width=\"@@width@@px\" height=\"@@height@@px\" class=\"hide\" playsinline></video>\n<audio id=\"@@AUTOID@@_player\" src=\"\"></audio>\n</div>","bodyend":"","script":"var qrs= requiredjs_qrtextreader;\nvar poodllfilelib = M.cfg.wwwroot + '/filter/poodll/poodllfilelib.php?datatype=speaktext&paramone=';\nvar thecam=$('#' + @@AUTOID@@);\nvar thebutton=$('#' + @@AUTOID@@ + '_button');\nvar theplayer=$('#' + @@AUTOID@@ + '_player');\n\n//This flag is so we dont scan while playing\nvar suspendScan=false;\n\n//when the player stops we recommence scan\n$(theplayer).bind('ended',function(){suspendScan=false; qrs.startScan('' + @@AUTOID@@);});\n\n\nthebutton.click(function(){\n theplayer[0].setAttribute('src',M.cfg.wwwroot + '/filter/poodll/ding.mp3');\n\n//we play a ding to warm up the touch device audio player\n var pp = theplayer[0].play();\nif (pp !== undefined) {\n pp.then(function() {\n console.log('playing');\n }).catch(function(error) {\n //do nothing . This is just so we trigger something for touch devices\n });\n}\n\n//we start the webcam\n qrs.startWebCam('' + @@AUTOID@@);\n\n//we tell what to do when a scan happened\n qrs.setCallback(function(data){\n \n //The logic here: https://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript\n // bytes->utf8 = unescape(encodeURIComponent(data));\n // utf-8->bytes = decodeURIComponent(escape(data))\n //we encode utf8 for qrcode writing but after reading we we need encode right away to send as url\n //so we simply escape the data read from qrcode. make sense? \n //console.log(decodeURIComponent(escape(data)));\n var src = poodllfilelib+ escape(data);\n\n //we do not continue if we are already processing a previous scan\n if(suspendScan){return;}\n\n //we set data to player and play\n theplayer.attr('src',src);\n var pp = theplayer[0].play();\n suspendScan=true;\n if (pp !== undefined) {\n pp.then(function() {\n console.log('playing');\n }).catch(function(error) {\n console.log(error);\n suspendScan=false;\n });\n }//end of if PP\n\n //TO DO: I think we could delete this line\n qrs.startScan('' + @@AUTOID@@);\n\n});//end of callback\n\n qrs.startScan('' + @@AUTOID@@);\n thecam.show();\n}); //end of button click\n\n ","style":"","dataset":"","datasetvars":"","alternate":"","alternateend":""}
1 change: 1 addition & 0 deletions presets/qrvoicemaker.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"QR Voice Maker","key":"qrvoicemaker","version":"1.0.2","instructions":"Enter the text to be read between the qrvoicemaker tags after they are inserted on the page.","showatto":"1","showplayers":"0","requirecss":"","requirejs":"https://cdnjs.cloudflare.com/ajax/libs/qrcode-generator/1.3.1/qrcode.min.js","shim":"","defaults":"format=\"text|ssml\",voice=\"Mizuki|Takumi|Nicole|Russell|Maxim|Tatyana|Miguel|Penelope\",size=6","amd":"1","body":"<div id=\"@@AUTOID@@\">","bodyend":"</div>","script":"//this writes the data as UTF8 bytes for non ascii. We decode in qr text reader\nqrcode.stringToBytes = qrcode.stringToBytesFuncs['UTF-8'];\n\nvar usetext = $('#' + @@AUTOID@@).text();\nconsole.log(usetext);\nvar typeNumber = 0; //the higher the number ... the more data\nvar errorCorrectionLevel = 'L';\nvar qr = qrcode(typeNumber, errorCorrectionLevel);\nqr.addData(@@format@@ + '|' + @@voice@@ + '|' + usetext);\nqr.make();\ndocument.getElementById(@@AUTOID@@).innerHTML = qr.createImgTag(@@size@@,8);","style":"","dataset":"","datasetvars":"","alternate":"","alternateend":""}

0 comments on commit d965800

Please sign in to comment.