This weekend, I spent my time trying to solve a few more problems in generating xAPI statements. There were a couple of things that I wanted to be able to accomplish:
- Generate statements from a YouTube video in a Moodle page
- Generate statements from a YouTube video in Storyline 2 in Moodle
It took quite a while to actually get these things working, but I got it done! I’m working on trying to articulate the code in my Github repository, but until then, I figured I’d talk a bit about it here. As I mentioned last post, the current Torrence Learning xAPI Learning Cohort has been a great impetus for actually experimenting with xAPI. I’ve been focusing on video since that’s something that my workplace is interested in. There were a couple of roadblocks this go round, because I was working in Moodle. In particular, trying to get the statements from an embedded YouTube video in a Storyline file launched from the xAPI launch plugin in Moodle was rather difficult and required a bit of work. The first thing I did was take a tip from the Storyline forums and embedded TinCanJS into Storyline by making a blank index.html page and embedding it alongside TinCanJS into Storyline as a web object. This meant that I didn’t have to continue to perform post-production surgery on the files to get this essential file into the mix.
So, I had it! But how could I get it? Well… I had to grab the page URL, use a function to grab the parameters from the URL, decode the URI so that the @ symbol, for example, looked like the @ symbol, turn all that into a JSON object, and then, THEN I could grab the information I wanted. So, there’s quite a bit of code I’m launching in a single slide. This code, I think, will need to be repeated each slide that has a video you want to track. When trying to just put it in one area, I found that it didn’t fire as it needed to.
So, there’s quite a bit of work to be done, but you can do it!!! Keep an eye on the Github Repo to get the code: https://github.com/anthkris/xAPI-video [Edit: I actually spent some time commenting and committing the code I have so far, so take a look at github for the code and some more information!] Let me know if you have any improvements!