How to create a button to make a screen capture (then have it emailed to someone)


#1

Hi I am new to Hype. I am trying to use Hype to create an Iphone App.
how could I create a button to allow user to make a screen capture (then have the captured image automatically emailed to me or someone)

Is it possible to get it done?
Any help will be greatly appreciated!


#2

#3

Thanks for the suggestion.
But that “html2canvas” seems a bit too complicated for a beginner (myself).
Is there any simple command that I can have it attached to a TextButton in Hype, then it will take a fullScreen capture for the user (for iPhone App and iPad App)?

Please help! Any help will be greatly appreciated! thx
Or it is not possible to achieve it in Hype?


(Mark Hunte) #4

Hi,

Do you mean a web page that is loaded via the normal Safari browser or you are building an iOS app.

If an iOS app.
Then since you are already using iOS code, you may as well do the screen capture via the iOS code.

Imagine you have a Hype HTML/scene load in a WKWebView in the iOS app.

The hype shows a button.
When that button is clicked. It sends a message to the iOS app to capture the screen.

But
1, If writing the canvas is beyond you then doing the code in Hype and iOS may also.
It just took me about an Hour to figure out the iOS coding to do the capture ( me being rusty )

2, The image will show the button and what ever else was showing at the time. Is this really what you want ?
Please add some detail.

Thanks


Video application
#5

Hi Mark,
Thanks so much for your reply! Yes, iOS app is what I am trying to create now.
Yes, your quicktime movie showed exactly the kind of effect that I wanted to achieve.
since I am very new to Hype, javascripts and iPhone apps, i am afraid i may not be able to handle complicated approach for that. It is better for me to keep it simple.

The attached image shows my objective which is to create one button (the red button) that allows user to make a screen capture. Then, the captured image will appear in its cameraRoll. Please suggest and direct me to some tutorials or related iOS commands. Any help will be highly appreciated! great thanks

regards


(Mark Hunte) #6

The above video is of an actual app I just wrote being run in the simulator but it uses a call from the HTML page via WKWebView Content to get the app to run a screen shot function only. It does not place it in the camera roll.

There is different code about on google that shows how to do that.

But:

Your best bet first is to download and go through the Apple Swift Guide
and the tutorials in iBooks and in Playgrounds.

Also do you really need to use Hype. iOS/Swift will provide all that is needed including interface.


#7

Thanks for your reply.
The reason I use Hype is to avoid too much Coding because I am not truly good at coding. Unfortunately, it seems Hype cannot provide easy solution when it comes to taking a screen capture…
Anyway, thanks for your help.


#8

in order to try this screen capture action and the ability of Hype, I found the following swift link:

But my problem is, how I could made that happened in Hype? (i am not an expert of coding.)
Could someone guild me?


(Mark Hunte) #9

I actually saw that thread when I wrote my example. But I used a different method as I was just capturing and not saving.

I wrote a post that explains how to control an iOS/MacOs app from Hype

The thread is long and evolved and there is more than one thing being shown.

But the gist of what you need to the is treat the Parent app the same way you would if you were to trying and control an iframe embedded in a Hype scene.

Post a message.

You can not control the app directly from a Hype scene. Even though the scene is being displayed within it.

What you can do is broadcast a message from the Hype scene (JS) and have the App listen out for a message coming from the Hype scene. ( actually WKWebViews content, which will be your scene )

If the message is of the correct name and type then the App can react to it using any function/code in the app you have written for taking a snapshot.

Messages can actually be sent from the App to the Hype Scene also.

And sorry before you ask I could post my example here but I honestly believe that you need to do some research so you gain some understanding. There are a couple of example already in the thread I listed, a little out of date due to being written in Objective - C and not swift if I remember correctly. But essentially the same methods used.


(Mark Hunte) #10

Ok I had a think and since I did not write the others in Swift I went and did a quick Swift version that saves and displays a snapshot.

I will add it to the other thread so as to keep it all in one place. I am not going to comment much on it apart from it being a swift version showing how to send messages to iOS/MacOS