Wednesday, March 4, 2015

A Huge Success! (3/4)

Another duplicate post, but I think it's needed.

Today, I got home and realized how close we were to getting the app to fully load the URLs and books, so I decided to start working. I guess I got into the coding zone, because in just an hour or so, I created 100 lines of code which essentially will be the basis for loading all books and all titles.

The way it works is pretty simple. We had already been saving the IDs when a user chooses a book, so I thought, why not save the title and chapter as well? I made localStorage saves for both of these when a user selects a book and chapter, and saved the title as well. I then created a chapter selection page (and I'll create loading methods so the user doesn't have to re-select a chapter soon). From here, all the chapter titles are loaded to a list, which the user may press and it will then provide the app with the book URL to load in an audio tag.

I highlighted the way I did all this on GitHub here. The app.js changes that made the most difference are here, and the chapter index HTML file is here.

I have to say, it was pretty great when I got this message in my console:


I'll start working on audio loading soon, as well as downloads and a file manager! Those three shouldn't be too hard to make.

NEW EDIT: It's now fully working! I did it using an audio tag (via HTML5), and in Javascript I used JQuery to handle the loading and audio functions.

NEW EDIT 2: I made full persistency of audio data. It's not perfect, but it's a great working version. If you have opened a book, and gone to a certain point, the app will automatically bring you to the book page, load all resources, and then bring your audio to your past point (where you last left it). It'll also change this time for later if you seek through the audio.


1 comment:

  1. The old adage "strike while the iron is hot!" comes to mind here. Nice post! Yes, indeed, the thrill of programming is thoroughly on display in your post here. I can almost feel your excitement as I read your progress toward a solution.

    I can't wait to take your app for a test drive. My test phone should arrive by Tuesday evening, so this Wednesday I'll be able to begin using it.

    ReplyDelete