I've come across some interesting behavior with the Wii U browser using Data URIs. A Data URI is a weird quirk of browser that allow full documents (HTML, Images, Videos, etc) to be stored entirely in the URI.
So for example, if you copy and paste the bellow Data URI in your PC browser as a URL:
You'll get a little star image. The star image is entirely encoded in the above URI and isn't stored on an external server. The concept is similar to magnet links.
The same can be done for HTML documents:
The above isn't base64 encoded, but encoding into base64 is useful when the data in question isn't text.
I made a sample webpage that demonstrates this:
wiiu.vgmoose.com/d
If you visit that on your Wii U, the first two links are to Data URI pages. For example, clicking the image example (second link), will load the above star image on your Wii U via a Data URI. You can then exit the browser, power off the Wii U, and the image will be there! And the coolest part is, even if there are no valid wifi networks configured the content loaded by the Data URI will always render. (can people test that this is actually true?)
So this is very close to getting any webpage to be able to be visited offline. But there's one major issue: I can't get this to work with video URIs! This seemingly prevents running Wii U Homebrew from a Data URI, as they are encoded as mp4's for 5.5.1.
It's not just homebrew mp4s that don't load, however. As seen at this url: https://iandevlin.com/html5/data-uri/video.php , Even valid .mp4 files don't play if they're data-uri encoded.
So the purpose of this thread is to seek answers... If we can get Data URIs to work with videos on the Wii U, then completely offline storage should be possible.
Why don't mp4 data URIs work?
I can't imagine Nintendo specifically blocked data-uri's specifically for videos, so I have a few theories:
1. the mime type "video/mp4" isn't actually what the Wii U uses for a video mime types (despite it working in HTML5, maybe it matters for data-uri
2. the mp4 url is getting truncated? I think this is unlikely, however, as you can see I have tests 1 through 6 demonstrating increasingly larger data uri links at my site, and the Wii U seems to handle all of them
Possible Workarounds
1. "Fix" the mime type?
2. Somehow load the video another way via javascript (not as a data URI)
3. use html5 blob objects?
Any insight is welcome. I'm pretty sure that something can be done here. MP4's can be saved (embedded in JS as HTML) to NAND via this trick, but they can't be executed!
Sidenote: if there are any non-mp4 based homebrew that exist, then this data uri trick should also work.
How to make a data URI
Where video/mp4 is the mime type. For an HTML page you can use text/html .
So for example, if you copy and paste the bellow Data URI in your PC browser as a URL:
Code:
data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7
You'll get a little star image. The star image is entirely encoded in the above URI and isn't stored on an external server. The concept is similar to magnet links.
The same can be done for HTML documents:
Code:
data:text/html,<marquee direction=right><h1>hello%20world</h1></marquee>
The above isn't base64 encoded, but encoding into base64 is useful when the data in question isn't text.
I made a sample webpage that demonstrates this:
wiiu.vgmoose.com/d
If you visit that on your Wii U, the first two links are to Data URI pages. For example, clicking the image example (second link), will load the above star image on your Wii U via a Data URI. You can then exit the browser, power off the Wii U, and the image will be there! And the coolest part is, even if there are no valid wifi networks configured the content loaded by the Data URI will always render. (can people test that this is actually true?)
So this is very close to getting any webpage to be able to be visited offline. But there's one major issue: I can't get this to work with video URIs! This seemingly prevents running Wii U Homebrew from a Data URI, as they are encoded as mp4's for 5.5.1.
It's not just homebrew mp4s that don't load, however. As seen at this url: https://iandevlin.com/html5/data-uri/video.php , Even valid .mp4 files don't play if they're data-uri encoded.
So the purpose of this thread is to seek answers... If we can get Data URIs to work with videos on the Wii U, then completely offline storage should be possible.
Why don't mp4 data URIs work?
I can't imagine Nintendo specifically blocked data-uri's specifically for videos, so I have a few theories:
1. the mime type "video/mp4" isn't actually what the Wii U uses for a video mime types (despite it working in HTML5, maybe it matters for data-uri
2. the mp4 url is getting truncated? I think this is unlikely, however, as you can see I have tests 1 through 6 demonstrating increasingly larger data uri links at my site, and the Wii U seems to handle all of them
Possible Workarounds
1. "Fix" the mime type?
2. Somehow load the video another way via javascript (not as a data URI)
3. use html5 blob objects?
Any insight is welcome. I'm pretty sure that something can be done here. MP4's can be saved (embedded in JS as HTML) to NAND via this trick, but they can't be executed!
Sidenote: if there are any non-mp4 based homebrew that exist, then this data uri trick should also work.
How to make a data URI
Code:
echo "data:video/mp4;base64,"$(cat helloworld.mp4 | base64 | tr -d "\n")