Thursday, December 19, 2019

i'm kind of paranoid about posting from the other laptop. at least if this chromebook gets dirtied up, i can just reset it. it's easy enough for now....

the last thing i had to do to before i could republish the html player to the inri000 page was to make sure that the front end works for all of the different file types. i thought maybe i could check to see what's sitting in the directory, but that breaks the standards - it's a security risk, and i guess i can understand that. so, i specifically can't do that. by design.

it turns out that the easiest workaround is just to set a bit in the src controls. i'll explain a bit better.

so, i posted the thing here, initially:
http://dsdfghghfsdflgkfgkja.blogspot.com/2019/11/im-going-to-post-last-update-to-this.html

my html5 control was initially this:

//this is the html5 control
<audio autoplay controls style="width:500px;height:50px" id="Player"src="first track">your browser sucks</audio>

it is standard to expand that a little to take into account different file types:

<audio autoplay controls style="width:500px;height:50px" id="Player">
<source src="first track in flac" type="audio/flac">your browser sucks</source>
<source src="first track in mp3" type="audio/mp3">your browser sucks</source>
.
.
.
</audio>

the documentation claims this is designed to maximize browser compatibility. for me, it's designed to maximize file type variability. i want the frontend to work, regardless of what the user has purchased. so, by adding in the extra code for each file type, the browser can find the right file in the directory.

but, that only works for the first file in the list. i still have a hardcoded array in the actual script that specifies what the file type is, namely:

var nextsrc = [list of file paths]

if i hardcode it to mp3, it won't work for the listener that bought a flac download. i want it to know what is what, but i'm blindside by the api.

all you need to do is this to start:

<audio autoplay controls style="width:500px;height:50px" id="Player">
<source src="first track in flac" type="audio/flac" t=0>your browser sucks</source>
<source src="first track in mp3" type="audio/mp3" t=1>your browser sucks</source>
.
.
.
</audio>

so, we will now have a unique value of t for each type. 

and this to finish in the script:

if (t=0){var nextsrc = [list of flac paths]}
else if (t=1){var nextsrc = [list of mp3 paths]}
.
.
.

i have tested this in firefox and it seems to be fine.

so, i now have a template for every other release, and i should be able to push forwards.