Android Question MediaProjection's createVirtualDisplay

peacemaker

Expert
Licensed User
Longtime User
Hi, All and expecially @moster67

As i posted here - the default screenshots of the MediaProjection lib are not fully corresponding to the device screen.
Stackoverflow already has the solution, @moster67, is it possible to update the lib ?
 

moster67

Expert
Licensed User
Longtime User
And why can't you have some patience?

I already wrote to you last Friday that currently, I am busy with other projects, with backlog at work after the holidays and also because I need to spend time with my family. And now you are here spamming all over the forum soliciting me. It would have been better you asked me again in PM.

Besides, your suggested solution does not work despite what you read on StackOverFlow. Don't trust everything there unless you understand the core problem. For inexplicable reasons, on many devices, a bitmap will be a bit larger, with excess unused pixels on each row on the end. So to resolve this, one needs to create a cropped edition of the original Bitmap, for the actual desired width.

If I manage, I will include an option to crop the bitmap in the next release where I will include also some other features. And the next version will be released when I find some free time as I already told you. If that is not fine for you, I will gladly refund you the donation you made.
 
Last edited:
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
moster67,
1) I need this lib for a commercial project that cannot wait so much.
2) If the lib cannot do its function well - it's useless lib. But function of this lib (i need) is "simple": just correct screenshot. I understand that it may be not easy in the code, but again - if impossible - i need to know it for sure. And ASAP.
3) As your paid lib cannot help me, and you also have no time for this - yes, i would appreciate to get the refund.
Sorry for my postings, but we all have different needs, times...
 
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
1) I need this lib for a commercial project that cannot wait so much.
It is NOT the problem of anyone in this Forum except you. And ONLY you.

Never read any Unfair comment as this one.
You now disqualified yourself with spanning the Forum.

I hope i do never ever get any more donation from you again! (which i later then need to refund)
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Don, you always replied and reply me aggressively. Why ?
What is the reason ? What unfair i told ?
If a lib is free, and the author has no time to help - it' clear, no questions.

But if lib is commercial, and some support is needed, but author is alive, and cannot help - what is the reason to pay for the lib ?
My postings were not so often, i posted and waited for any reply, but no reply from the @moster67
Now he replied, all clear, my posts can be deleted, but ... i paid for useless lib.

It is NOT the problem of anyone in this Forum except you. And ONLY you.
It was reply to moster67, explaining the need, your aggressiveness here no idea why.

I deleted the post in the lib thread. Where spam posts more?
When you publish a paid lib - you can write that "no support is provided, no refund possible" and all again would be clear in advance.
 
Last edited:
Upvote 0

moster67

Expert
Licensed User
Longtime User
Just a note about me not replying.
-You sent me a PM last Friday and I replied the same day telling I will look into it when I have some time. Then apparently you started to post in the forum which of course will not trigger any notification to me and make me aware of such posts since I don't read the forum every day and not even all posts. If you think, putting an "@" in front of my username should give me a notification, then you should know it does not. Maybe Erel should check if this forum feature works. At least for me, it does not and never has.
When you posted in the library thread yesterday, I got a notification and I posted my reply in this thread. As I told you, if you would have written another PM, I would have gotten back to you.

What regards support,
-I always try to help out and fix any problems regardless if a library is donation-ware or free. I receive lots of PMs and emails, even from users asking for general advice, which I reply to. I have wrapped many SDKs, not published here, and many of those clients are continually sending me work. I interpret that as they are pleased with the work delivered and the support I give them.

That said, since you are not pleased with the library and made that very obvious here in the forum, I am going to refund you by PayPal. If the refund comes back to me, I will make a donation to a charity.
Edit: refund made
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
"@" in front of my username should give me a notification, then you should know it does not.
Indeed, i thought that this feature might help !
Thank you for explanation again, and sorry, i deleted the post.

In whole, as i can see the root is time - and even some paid things cannot be got immediately.
Seems, for urgent commercial tasks, a needed lib must be ordered\developed especially, and with access to the source code - payment for some ready lib could not help to solve a trouble immediately.
Thanks again.
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
If I manage and when ready, I will send you an updated library despite I have already refunded your donation.
Just as a hint, for your specific problem, you should be able to resolve it by B4X code directly in B4A in the Result-event by cropping the black borders from the bitmap you received through BitmapRetrieved. In this way, there is no need to wait for an updated library.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Thanks. But, seems, this cannot help fully anyway (the screenshots have "errors" not only by the black borders, but it's another topic)
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
My only strange "experience" using MediaProjection and my screen projection sample are the black borders on the sides which I now know is normal unless you crop the borders.
Therefore, please report your errors in the library thread with a full explanation and how to reproduce them and I will see if it is something I can fix and perhaps I can include such corrections in the update.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
I already tried to explain the trouble here: https://www.b4x.com/android/forum/threads/correct-showing-the-screenshots-of-other-screens.112658/
Formally, black borders is not a error, if you need a screenshot just to see the content, but if to use the screenshot as the screen copy to tap over it for the remote control- it's incorrect screenshot, wrong size, sides....
I see that it's Google's triks, but the task to just get the screenshot fully corresponding to the remote screen (that can be any, with the notif area, activity title, bottom system buttons area).
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
Well, then I doubt that is really a problem with the library and the images it produces.
You will need to investigate how to tackle such a situation but that, as you already did, should be done in a different thread while here it is off-topic.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
a problem with the library
No


and the images it produces
Yes :), images non-corresponding the screen size and sides (ratio).

When and if you have time or need - try to check something, i see that here they mentioned .getMetrics and .getRealMetrics with comment:
The problem is that the decorations around the image corrupt the actual resolution of the screen. getMetrics() returns a height (or width in landscape) that is not accurate, and has the home, back, etc, buttons subtracted. The actual display area available for developers is (1440 x 2326... or something like that). But of course, the captured image is going to be the full 1440 X 2560 screen resolution.

But i'm not pretending already to be the lib user, according to the situation.
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
I already told you I tried the fix that the SO thread suggested but it does not work. The images produced by MediaProjection/my library are full and complete and do not subtract any information such as home buttons etc. You will need to work with the bitmap produced using the hint I gave you. Maybe I can do the cropping in the library itself. However, I believe there will be scaling issues anyway when shown on a different device so eventually, you will need to take care of that yourself in B4A when you try to get the right coordinates. I am out of this thread since it is now off-topic.
 
Upvote 0
Top