B4i Library SD: iHttpServer (beta)

Waldemar Lima

Well-Known Member
Licensed User
Longtime User
If you use the personal builder you have to copy the .h libraries
Which example are you trying, the one with webSocket or the one with just HTTP?
trying build on b4i Hosted Builder
i am trying both examples ...

the websocket example shows this error:
B4X:
B4i Version: 7.20
Parsing code.    (0.01s)
Building folders structure.    (0.04s)
Compiling code.    (0.02s)
Compiling layouts code.    (0.00s)
Compiling debugger engine code.    (0.91s)
Building Xcode project.    (0.13s)
Preparing project for builder.    (0.03s)
    Project size: 0.16 MB
Sending data to remote compiler.    Error
B4i line: 266
Resp.Query.RunMethodWithResult(\
no visible @interface for 'b4i_servletresponse' declares the selector '_getquery'
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
I can't understand the problem, I have tested it again and it works fine for me. It seems that no methods are found by you or they are considered confidential and not accessible.

I need to do more research, I can't help you at the moment
 

Star-Dust

Expert
Licensed User
Longtime User
NOTICE
The library has been updated to be cross-platform and you can find it in this THREAD
 

Star-Dust

Expert
Licensed User
Longtime User
After so many attempts the problem may be because I compiled into the secondary hosted constructor. Now I have also compiled on main. If you use the hosted builder you can give it a try.

If you use a local constructor, the problem may be in updating it to the latest version.

In a similar problem from another library these two methods solved the problem.
 

Waldemar Lima

Well-Known Member
Licensed User
Longtime User
Awesome ! i'll try, thanks by support <3
 

watesoft

Active Member
Licensed User
Longtime User
Is it possible to provide a non-cross-platform version? The B4I version I used does not support cross-platform. thank you!
 

Star-Dust

Expert
Licensed User
Longtime User
When multiplatform is indicated it does not mean that the same library runs on 3 platforms, but that there is a version of the same library for each platform. Each version is single platform.

Go to the new thread and download the ios version.
 

watesoft

Active Member
Licensed User
Longtime User
When multiplatform is indicated it does not mean that the same library runs on 3 platforms, but that there is a version of the same library for each platform. Each version is single platform.

Go to the new thread and download the ios version.

When multiplatform is indicated it does not mean that the same library runs on 3 platforms, but that there is a version of the same library for each platform. Each version is single platform.

Go to the new thread and download the ios version.

Thank you for your reply, I called a third-party js file in my APP, which uses xhr to request some note files in MP3 format, and the http path must be used. So I plan to use a local httpsever(For example: http://127.0.0.1:51051, you can see it on lines 60-90 of the karaoke.html code file), which is already ok in the Android app (using httpserver written by Erel). I use your ihttpserver lib in ios but it doesn't work, I haven't written a web app before and know almost nothing about web programming, so would appreciate your help, thanks a lot.

There is an acoustic_grand_piano-mp3 folder in soundfont.zip, which is used to store musical notes MP3 files, because they are too large to upload, you can see it in the js (https://github.com/paulrosen/abcjs) file.

XHR JS snippet:
var xhr = new XMLHttpRequest();
    xhr.open('GET', url + instrument + '-mp3/' + name + '.mp3', true);
    xhr.responseType = 'arraybuffer';
    var self = this;
 

Attachments

  • Httpserver.zip
    7.7 KB · Views: 7

Star-Dust

Expert
Licensed User
Longtime User
the SoundFont.ZIP file inside is empty. I need to have it to test
 

Star-Dust

Expert
Licensed User
Longtime User
I got the mp3 files with the piano notes.
I copied the files to the Laragon server they don't work. You've probably forgotten some scripts
 

watesoft

Active Member
Licensed User
Longtime User
Sorry, is this the js file? Unzip abcjs-basic.zip,you can find it.
I put all the files on a network disk, I don't know if you can download it.http://watersoft.ysepan.com/?xzpd=1
In the html file, I changed the address of the soundfont to the local soundFontUrl:'http://127.0.0.1:51051', which is requested from the remote server by default.
Actually what I care about is how to start the http://127.0.0.1:51051 service in B4I, I don't know if the code I wrote in b4i is correct?
 

Attachments

  • abcjs-basic.zip
    220 KB · Views: 5
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
abcjs-basic was there and in any case they could be downloaded on github.
The problem I think is in the web pages. As I told you I used a commercial http server (Laragon) and putting all the files does not work. The JS code does not load the various notes and therefore does not execute them.

I should study the JS code to understand what is missing, but as you surely understand, I don't have the time to do it.

If you have a working Android version, please attach it so I can see the differences.

Try running it with a commercial server. I think you should start with the ready-made examples on GitHub with port 80 on a commercial server. When everything works, you can transfer it to iHttpServer
 
Last edited:

watesoft

Active Member
Licensed User
Longtime User

Thanks a lot, I noticed that adding the code 'Svr.Start(51051)), there is an error(see b4i error log.jpg), removing the code the error disappears.

In addition, I uploaded a successful example of B4A, sondfont.zip is the same as the example of b4i.
 

Attachments

  • A-httpServer.zip
    381.4 KB · Views: 7
  • b4i error log.jpg
    49.7 KB · Views: 10
  • b4a staff ok.jpg
    22.3 KB · Views: 10
  • b4a ok log.jpg
    34.4 KB · Views: 10

Star-Dust

Expert
Licensed User
Longtime User
I found several things wrong with the code you use on iOs.

We assume that even on Android when I click PLAY it does not sound.
I saw in the pictures you posted that you recall the notes individually (eg A0, A1). I did the same and this is how it works (even if instead of playing the audio I download the MP3 file).


The same you get in iOs if you unzip the SoundFont file in the correct folder which is not Prog as you put in your B4I code

Finally the script to me does not even work on Android, so I repeat what I have been telling you for a few days, there is something wrong with the JS script.

The code you have in android is more complex, check the folders on which the request is made and set the type of content before responding to the browser, this is very important for the operation. But on iOs all this part is not there.

I think you need to go deeper into the subject and always try to work on a commercial Http Server such as laragon or similar and then if it works, transport it to B4X.


I can not give you any other help on this topic I have to follow my work and therefore I will not reply to your posts anymore. I wish you to solve.
 

watesoft

Active Member
Licensed User
Longtime User

I'm very sorry to bring you so much trouble. In fact, this matter has troubled me for a long time. Android can really play sound well, and it has been used in my app for half a year. But it doesn't matter. I can use the remote soundfont temporarily,After finding the reason in the future, I will switch to the local server. Can you provide a successful example of the local httpsever? Let me check the cause of the error, Thank you very much for your help!
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…