A couple of things are catching my eye as potential issues here:
I see data:type="audio/mpeg", but really the data type is still "text/html" if the payload is still an html webpage. (Even if that webpage contains some audio, it is still an html page.)
Two common approaches for this type of thing:
1) More contemporary, v.19 approach:
2) Common approach prior to v.19, and still perfectly good approach:
- Create the entire HTML page code within FileMaker (using calcs and scripting), and then set the webviewer to use this calculated HTML code.
- I note that this is already the direction you have taken (or very similar).
- The thing that you would need to do differently would be to literally embed your entire Base64 string into the HTML that you compose within FMP -- not just a variable reference such as $$AudioFile, but rather the entire Base64 string. I'll often just include a var, const, or let statement to declare a variable, and set the value to the Base64 string.
e.g. excerpt from a sample FMP calc:
"var myBase64Data = '" & Base64EncodeRFC( 3548 ; MyTable::MyContainerField ) & "';"
Note that, above, I used an RFC number which does not include line-breaks in the encoded output.
- Because you were able to get it working in a standalone html file, I think you are really close to getting this to work in a webviewer in a basic FMP client situation.
- If the above isn't clear enough, and you can share some excerpt of what you have working in a standalone page, I'd be happy to see if I could make a suggestion based on what you are able to share.