Difference between ways of loading html files to WebViewer

Hi, I am working on the FireBase Authenticator tutorial, and I had an error while trying to load my html file FirebaseAuthenticator.html with the path file:///mnt/sdcard/Appinventor/assets/FirebaseAuthenticator.html and it didn't work. I looked back on related forums to try different solutions, but only the localhost one worked. I am working on an Android emulator.

Screenshot 2023-03-08 001221
Screenshot 2023-03-08 001303

When this didn't work, I then switched to file:///storage/emulated/0/AppInventor/assets/FirebaseAuthenticator.html, but it still gave me the same error (file not found) as pictured above.

Screenshot 2023-03-08 002009

Finally, I tried http://localhost/FirebaseAuthenticator.html and my app finally ran.

I was wondering why my original two attempts didn't work (the mnt one and the storage/emulated one), when it worked for a lot of other people. Is there something wrong with my setup and how do I fix it? How can I use these two in the future? What is the difference between these two and the localhost?

Thank you!

If you are loading html from assets, use the url http://localhost/your.html, this works in companion and apk.

Android keeps changing from version to version.

If you got the sample here, please post the link so we can update it.

See also discussion here:

I just read through the linked discussion. I will just use http://localhost/~ in the future. Thank you for all of your explanations!

ı am having issues with Localhost. Since my videos are larger than AppInventor limits, i wanted to download them into ASD then call them to webviewer. An html file which contains the name of video is in media section of app design window so it means it is in assets folder in internal storage. But of course my videos are downloaded into ASD folder in external storage, i searched much and tried much but i couldnt find a way to Run this html file to make a video to play which is located in ASD folder.

you can copy the html file to asd, same folder with your videos.
then load the html like this:
image

An html file "should" load an asset (media files etc.) from elsewhere in the file system if you use a full path to that asset in your html, e.g. one that starts with file:///..... There may be edge cases where this does not work.

I copied the html file that has been put there via media section of designer window To asd via Taifun’s CopyFileAsync block, i even checked if it has been copied and yes it has but i couldn’t Run it with again Taifun’s GetAsdDirctory block with /file.html text in txt block with Join element. I guess somehow this two text combination which is targeting a path to html doesn’t work. This “scope” method i guess searches everwhere in app folder and Asd too. I will try but its interesting since it it calling an Url and there is no block in your example which starts with “http://“

Umm i am sorry i cant find that red block which says video.html

ı can put my html files to assets in internal storage by simply adding html files through design screen but i cant call videos which are downloaded to ASD. I tried different paths but didnt work so i am trying to copy that html file to asd from assets and it doesnt work and i dont know why i cant directly download the html file also, to asd next to videos an run it in asd. Basically i cant run a html file in ASD folder and i cant call a video which is in ASD from the html which is in Assets in internal storage (i guess)

My videos are My assets but more than 5 mb so i used an asd downloader to download them to asd so they are not in internal storage where original assets are but i just cant play them, i cant call them

@sTan

Please try this, working OK for me

viewvideohtml.aia (431.9 KB)

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.






Actually it works as you see in last picture that html file is coppied from assets to asd(files)

I have no idea how you are playing this video without zoom controls, i cant achieve that clean look with WebviewExtra extension which looks like this;

aaaaazz

ı dont have this red block with the arrow

Wait! your video is .webm. my videos are .Mp4.. thats the cause?

AND.. you are transferring webm video file from assets to asd? i cant do that.. my videos are larger than 5 mb. i must directly download them to asd. and it doesnt work with the html that i transfer from assets to next of videos in asd

I can zoom the webviewer here...

It is an asset in my example.

I have found webm format works best on AppInventor with the webviewer for htm5video.

This was just an example, the video had to come from somewhere to be put in the ASD, alongside the html file, in my example aia.

It is interesting that i have found that red block in the blocks of Button....

i dont want zoom controls for a clean look.

i will try to convert my mp4 videos to webm and try the call process again

"Somewhere" ? to have underlying java code? ok, it works if i download them to asd via asdDownloader extension too?

Zoom seems to misbehave on some devices with webviewextra, even though the setting you use should remove all zoom features. i have not been able to fix it.

No reason why not, ensure the filename of the downloaded video matches the filename in the html file.

Can you use extensions ?

Given you have your own html file, try adding this line just below the <html> tag at the top:

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

This should prevent zooming.

1 Like

I added the code below start of html tag and it works, thats great, thank you very much that will be awesome for a clean look but i tested it in the aia bunny webm sample that you gave, because as you already know neither asdDownload nor Web1 methods didnt let me download a 1 mb webm video yet. I am getting drown in extensions :slight_smile:

I dont know whats time there and you and other heroes are still here for a long time but my head hurts more than my back hurts i guess i need a coffee break at terrace because its just frustrating that why 1mb webm file just doesnt download fully but stops downloading when it comes to 800kb. I need some to time to get my determination back, and that html tag addition is really gave me what i was also looking for, thanks for that again.