Custom camera view on iOS from HTML5 - ios

I'm building an app for iOS which I'm currently developing using web programming languages. HTML, CSS, jQuery etc. I do that because it's quicker for me to work with these languages, in a first time.
My app will give users the possibility to record a video, and I know it is possible to do that since iOS 6 with HTML5 and to upload it to my server. However, I would like to be able to create a custom camera view, for example just like the one in Snapchat, with the ability to record a custom duration for the video (for example max 20 seconds), with a progress bar etc.
My first question is : from HTML5, is it possible to limit the duration of the record of a video ? For example with maximum 20 seconds ?
Second question : is it possible for me to continue to develop my app with web languages and when the user clicks on the "record a video button", an event is fired IN the iOS code directly ? So I can launch a custom camera view in iOS language and then send it directly to my server from the iOS code ?
Thanks for your help.

First question:
No, you can't create a custom camera view in HTML. This needs to be done in Swift or Objective-C on the device.
Second question:
I've read, that the new WKWebView can recieve messages from a Javascript.
This tutorial explains, how your app can communicate with the Javascript via delegate-calls. It requires, that your content is NOT displayed in an UIWebView, but in an WKWebView (iOS 8 or newer required)

Related

Any way to enable user interaction while viewing fullscreen video in iOS browsers?

My research tells me that there is now way to escape fullscreen video viewing in iOS browsers on iPhone or iTouch. It also seems there there is no way to modify the native controls that are displayed along with the video. Is the user in a total blackbox while viewing video in this case?
I'm trying to find someway for a user to indicate that they like a video as it is playing. Is there anything I can do that isn't a hack? If not is there any indication from Apple that they will ever be willing to change this? I'd rather not make an app out of this project.
You actually can play a video in line on an iOS browser, if this is what you are aiming for although there are restrictions - updated answer:
Play video inline in a browser on iOS
Safari on large screen iOS (iPad) should support inline video (I don't have iPAD hand to verify this still works...).
Safari on 'small screen' iOS (i.e. iPhone) will not support inline video as standard. There is at least one workaround which will allow it but this does bypass much of the native video playback performance gains so it may not meet your needs. It is a work in progress still as you will see from the link, but try the demo on an iPhone browser - you need to hit the small play button beside the video, rather than the one on top of the video at the time of writing:
https://github.com/newshorts/InlineVideo
Playing inline in a UIWebView on iOS
Take a look at this Apple Developer page:
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIWebView_Class/index.html#//apple_ref/doc/uid/TP40006950-CH3-SW31
In particular:
allowsInlineMediaPlayback
A Boolean value that determines whether HTML5 videos play inline or use the native full-screen controller.
and:
Discussion
The default value on iPhone is NO.
In order for video to play inline, not only does this property need to be set on the view, but the video element in the HTML document must also include the webkit-playsinline attribute.

HTML Recording video on iOS

I'm new to HTML coding, and i'm currently trying to build an app in iOS like snapchat, that will take a users camera and record without stopping if the user goes into the main menu or whatever. I'm looking for some HTML5 code that will allow me to have the main interface just be the back camera output, with buttons that i'll have over the front.
A few searches have led me here: http://www.html5rocks.com/en/tutorials/getusermedia/intro/
Which I have tried to make work but iOS does not support it.
I'm basically asking: How do I make an app record video with it starting on screen?
You could write a web app to do this, but not a native app (i.e. from the App Store). For that, you'll need to learn Objective-C or Swift, then take a look at the AVFoundation framework.

Trying to create an Xcode Objective-C function that records a video capture of my UIView contents and saves to phone

I'm trying to create an Xcode Objective-C function that can be called from a button tap, that will record the contents of a UIView and its subviews (or a fixed section of the screen e.g. 320x320 in the center) and then allow the user to save the video to their iPhone camera roll. I also want to include the audio that is being played by the app at the time of the recording e.g background music and sound effects.
I'm having trouble finding any info on this as their seems to be a lot of people trying to record their running app for external purposes like the app store video preview. I need my video captured within the app, to be used as an app feature.
Does anyone know if this can be done or know a website or tutorial where I can learn what's needed? Thanks
I know this post is two years old, but for anybody who comes along who might need to record their iOS app's screens and save them to the phone's camera roll or even a specific URL, take a look at https://github.com/alskipp/ASScreenRecorder
I've tried it and it works! The frames per second aren't 60 so I don't know how well it would work if you were trying to record an action game, but it's still pretty awesome.
You can't do that with just one function, check that project:
https://github.com/coolstar/RecordMyScreen

linking an inline swf wall post to a native ios app

I have a Facebook application where you can create an animation and share it on your wall. Each feed has a swf player that lets users to play the animation directly on the wall. (like any shared video). As IOS does not support flash, I have also created a native IOS application for playing those animations.
These posts can't be played on IOS devices, when touched, 'Flash Player update required' placeholder is shown.
What I want to do is, to have an alternative link for iPads to play these feeds on my native IOS app (like fb://APP_ID/video_url).
Is it possible to provide a native IOS App url for inline swf feeds?
I don't think swf playing is possible on iOS, inline or not. The only thing you can do, is to convert that animation to an iOS compatible format, like QuickTime, or HTML5.

iOS Background Audio in a Web App

I am writing a web app that uses HTML5 audio. I want to make sure that the user can move to a different application while still listening to the audio in the background. This works while the web app is still within Safari itself. However, when the user adds the web app to their homescreen and it has been set to allow for fullscreen access (no Safari toolbars), when they leave the app the audio does not continue to play. Does anyone know of any way to have a web app proceed while in the background?
Thanks.
I observe exactly the same thing. It's really puzzling as to why Safari, webkit on iOS I suppose really, handles it differently in the two cases.
I notice one thing that might be a small clue, when running as a home-screen'ed 'app' when you playback the audio the iOS status bar (at least on my ios4.1/iphone4) does NOT show playback indicator (blue triangle). But when using the site directly via Safari (and the sound stays in the backgroun as expected) it DOES show the playback indicator.
I think the only people who can probably answer your question are apple since it's their webkit implementation. If you haven't already I would urge you to take this up on the apple developer message boards.
For others not familiar the 'full screen access' Dan is referring to is a Safari specific meta tag that enables a bookmarked web page to open in safari 'full screen' without the location and menu bars.
While HTML5 is making progress on supporting device native features through HTML 5 APIs (such as accelerometers, etc) having true background audio seems like it hasn't really been spec'ed out yet. By background I mean when the browser is not the application that the user is currently focused on. It was only more recently that iOS even supported application multitasking which is what making the behavior from safari possible but it's a separate thing together to integrate that tightly with the OS'es native audio control features, which is what would need to happen.
This is not possible, at least not currently. You are playing the audio from the browser and when the browser closes the system kills the app, or freezes it, unless it has multi-tasking support(but that isn't allowed for web apps)
In iOS 5 and Android 4.0.3, putting a browser window to background does not stop playback. I am not sure about other versions prior to them.
You can do so with an iPhone 4. On my website, I posted a song with the simple html5 tag and I went on it with the iPhone 4. Played the song, left the app. Song runs in the background and there is even a play button on the top bar like when you listen to music on the iPod app.

Resources