[B4X Tool] - B4XIDEViewer V. 1.0
What is B4XIDEViewer?
-It’s a B4X Tool which can show bitmaps, images and saved pictures from your B4XIDE on your computer. You can also play video and audio files present on your device. You can transfer files from the device. You can show and search huge text files, show PDFs, GIF-images and more….
Why B4XIDEViewer?
-Well, I like working with MultiMedia, such as bitmaps, images, audio, video. I extract frames from a video, do something with each image and then reassemble everything to a new video or GIF-image. In order to see the results, I need to implement a player in my app, save bitmaps to a png/jpg and then display it in an ImageView or I need to open the shared folder on my PC but this is very often slow.
With B4XIDEViewer, I can now simply send the image/video/file directly from the B4XIDE to the computer and display it. I just write a log-command. I can easily do this directly in my code and of course I can set breakpoints at these log-commands. Now I can see how an image gets generated while applying certain effects, step by step. You can do this while debugging. You have a history of all images you created.
The Client Library is attached to this post and works with all platforms i.e. B4A, B4i and B4J. It is a single B4XLib and you install it like any other library. Sample projects are provided and also the source code of the library is available if you extract the B4Xlib. I could have actually provided only one sample project since the code is the same for all platforms.
Installation:
B4XIDEViewer Client Methods/Events
Author: Mikael Osterhed (moster67)
Version: 1.00
ViewerUtility
Final words:
This project was based on Erel’s “b4x-network-asyncstreams-b4xserializator” sample-project which you can find here.
I am also using Erel’s “xCustomListView” with LazyLoading. You can find further information about this very versatile object here:
Since the forum is a wealth of useful information, I have of course sometimes used sample-code found here and modified it accordingly to my needs. It would be stupid not to take advantage of this fact. My kudos to those authors.
I have also posted in the forum some of my solutions used in this project.
This was one of the these stupid ideas I had, using libraries, in perhaps not in a common and not intended way to achieve something which I was missing from the IDEs. It is a work-around to facilitate working with multimedia from the client IDE's. Ideal would of course be if some of the functionality provided by my project would already be included in the standard IDE.
Remember to remove the library and the specific debugging code when compiling your release code.
Maybe the download link got lost above, so here it is again:
-Download the B4XIDEViewer program jar-file from here
Update: March 12, 2019
-updated client library with new method: LogCanvas
Update: March 13, 2019
-there is now only one single B4XLib and which works with all platforms
I am still planning to add some more features and once ready, I will publish also the source code of the main app i.e. B4XIDEViewer which was developed in B4J.
If you have any suggestions how to improve this project, please post them here.
Here is a short demo video:
On my (just started) YouTube channel, Moster67's B4X Corner, you can find a full demo too. Please subscribe now! I have lots of ideas for this channel which I think you will find interesting.
Hope you like it.
What is B4XIDEViewer?
-It’s a B4X Tool which can show bitmaps, images and saved pictures from your B4XIDE on your computer. You can also play video and audio files present on your device. You can transfer files from the device. You can show and search huge text files, show PDFs, GIF-images and more….
Why B4XIDEViewer?
-Well, I like working with MultiMedia, such as bitmaps, images, audio, video. I extract frames from a video, do something with each image and then reassemble everything to a new video or GIF-image. In order to see the results, I need to implement a player in my app, save bitmaps to a png/jpg and then display it in an ImageView or I need to open the shared folder on my PC but this is very often slow.
With B4XIDEViewer, I can now simply send the image/video/file directly from the B4XIDE to the computer and display it. I just write a log-command. I can easily do this directly in my code and of course I can set breakpoints at these log-commands. Now I can see how an image gets generated while applying certain effects, step by step. You can do this while debugging. You have a history of all images you created.
The Client Library is attached to this post and works with all platforms i.e. B4A, B4i and B4J. It is a single B4XLib and you install it like any other library. Sample projects are provided and also the source code of the library is available if you extract the B4Xlib. I could have actually provided only one sample project since the code is the same for all platforms.
Installation:
- Download the B4XIDEViewer program jar-file from here and save it where you want, for instance on your desktop.
- Create an incoming firewall-rule on the computer where B4XIDEViewer will be executed. The easiest way to do this is to use the command prompt (Windows):
a) Make sure you open an administrator command prompt. Click on Start, type in CMD and then right-click on Command Prompt and choose Run as Administrator.
b) Type the following command followed by the Enter-key:
B4X:netsh advfirewall firewall add rule name="B4XIDEViewer" protocol=TCP dir=in localport=51070 action=allow
d) Note: if you are using B4J as a client IDE and it is installed on the same computer where B4XIDEViewer is running, then there is no need to create a firewall-rule.
e) If the standard port 51070 is already in use on your computer, you will need to change the port into another port. Just change the command above accordingly and change the port in B4XIDEViewer. - Open B4XIDEViewer and when prompted, open Settings and click on the “Save&Exit” button. Now B4XIDEViewer is ready and will await connection from a B4XIDE such as B4A, B4i or B4J.
- Download the B4XIDEViewer client library from this post and copy it into the corresponding Additional Library folder(s) for B4J, B4A and B4i. Make sure to refresh the library-pane in your B4XIDE. Note: if you use @JordiCP ’s excellent OpenCV wrapper for B4A, then there is a separate B4XIDEViewer client library available. It is distributed separately because it includes a dependency to the OpenCV wrapper. The library is “B4AIDEOCVViewer.b4xlib” and is attached to this post.
- You are now ready to use the B4XIDEViewer!
B4XIDEViewer Client Methods/Events
Author: Mikael Osterhed (moster67)
Version: 1.00
ViewerUtility
- Functions:
- ClearAllImages
Clears all images shown in B4XIDEViewer. - Connect - connects to B4XIDEViewer
- Initialize (CallingModule As Object, EventName As String, IPAddress As String, PortToUse As Int)
Initializes the object. Set IP Address and Port Number of
the computer where B4XIDEViewer is running. Default
port is 51070 but may be changed in the B4XIDEViewer app.
You should now monitor the connection-events by creating
two separate subs named EventName_Connected and EventName_Disconnected.
In future versions of B4X products, this last step may be
available in the AutoComplete list. - LogFile (Dir As String, FileName As String)
Passes a saved file to be shown in B4XIDEViewer.
Each file is sent separately over the network. This is like a file-transfer. - LogGifImage (Dir As String, FileName As String)
Passes a saved GIF-image to be shown in B4XIDEViewer.
[*]LogCanvas (cvs As Canvas)
Passes a single Canvas to be shown in B4XIDEViewer.
The canvas will be changed into a Bitmap and sent separately over the network.
[*]LogImg (BP As Bitmap)
Passes a single Bitmap to be shown in B4XIDEViewer.
Each Bitmap is sent separately over the network.
GIF-format is not supported. Use the method LogGifImage instead.
[*]LogImgList (BitmapList As List)
Passes a list of Bitmap(s) to be shown in B4XIDEViewer.
The list is sent over the network and then unpacked.
GIF-format is not supported. Use the method LogGifImage instead.
[*]LogMatImg (Mat As OCVMat)
Takes an OCVMAT and converts it into a Bitmap to be shown in B4XIDEViewer.
Each Bitmap is sent separately over the network. Only present in OpenCV version.
[*]LogMatImgList (MatList As List)
Takes a list of OCVMATs and convert them into Bitmap(s) to be shown in B4XIDEViewer.
The list is sent over the network and then unpacked. Only present in OpenCV version.
[*]LogSavedImage (Dir As String, FileName As String)
Passes a saved image to be shown in B4XIDEViewer.
Each image is sent separately over the network.
The FileName is case-sensitive. Make sure to include also the suffix.
GIF-format is not supported. Use the method LogGifImage instead.
[*]LogStringData (StringData As String)
Passes StringData to be shown in B4XIDEViewer.
Each StringData is sent separately over the network.
[*]LogVideoAudio (Dir As String, VideoName As String)
Passes a saved Video/Audio file to be played in B4XIDEViewer.
Each Video/Audio file is sent separately over the network.
[*]LogVideoAudioStream (StreamingURL As String)
Passes a Streaming-URL to be streamed in B4XIDEViewer.
The URL-link is passed on as a String and will stream from
B4XIDEViewer if protocol and codec are supported.
- ClearAllImages
Final words:
This project was based on Erel’s “b4x-network-asyncstreams-b4xserializator” sample-project which you can find here.
I am also using Erel’s “xCustomListView” with LazyLoading. You can find further information about this very versatile object here:
Since the forum is a wealth of useful information, I have of course sometimes used sample-code found here and modified it accordingly to my needs. It would be stupid not to take advantage of this fact. My kudos to those authors.
I have also posted in the forum some of my solutions used in this project.
This was one of the these stupid ideas I had, using libraries, in perhaps not in a common and not intended way to achieve something which I was missing from the IDEs. It is a work-around to facilitate working with multimedia from the client IDE's. Ideal would of course be if some of the functionality provided by my project would already be included in the standard IDE.
Remember to remove the library and the specific debugging code when compiling your release code.
Maybe the download link got lost above, so here it is again:
-Download the B4XIDEViewer program jar-file from here
Update: March 12, 2019
-updated client library with new method: LogCanvas
Update: March 13, 2019
-there is now only one single B4XLib and which works with all platforms
I am still planning to add some more features and once ready, I will publish also the source code of the main app i.e. B4XIDEViewer which was developed in B4J.
If you have any suggestions how to improve this project, please post them here.
Here is a short demo video:
On my (just started) YouTube channel, Moster67's B4X Corner, you can find a full demo too. Please subscribe now! I have lots of ideas for this channel which I think you will find interesting.
Hope you like it.
Attachments
Last edited: