Audio/Video HTML5 Form Input Capture via PHP Primer Tutorial

Audio/Video HTML5 Form Input Capture via PHP Primer Tutorial

Audio/Video HTML5 Form Input Capture via PHP Primer Tutorial

We’ve spoken before about the wonderful HTML5, and its capabilities to upload audio and/or videos to a web server (or, with Share functionalities onto public repositories like YouTube, should you wish).

The key attributes to an HTML input element, as outlined at this W3C Media Capture link, to be able, on many smart phones and tablets, to capture that audio and/or video input are …

  • accept
  • capture

… as per …

The capture attribute is a boolean attribute that, if specified, indicates that the capture of media directly from the device’s environment using a media capture mechanism is preferred.

The capture IDL attribute MUST reflect the respective content attribute of the same name.

When the capture attribute is specified, the user agent SHOULD invoke a file picker of the specific capture control type.

If the accept attribute’s value is set to a MIME type that has no associated capture control type, the user agent MUST act as if there was no capture attribute.

… as we use in our PHP code snippet …


<input onclick=" document.getElementById('submit').style.display='block'; "
style="font-size:26px;height:60px;background-color: yellow;"
type="file" name="upload" accept="audio/*" capture></input>

And so we present this in an early days PHP web application that will only function for very short audio/video captures, but testable on iOS iPhones or iPads and we think it will also work on Android mobile devices, as long as the captures are short. So far, its functionality just goes towards uploading your work to our web server and playing it back to you.

The PHP live run link is associated with PHP code you could call upload_audio.php and download, as you wish.

We hope this is more food for thought for you.

If this was interesting you may be interested in this too.

This entry was posted in Android, eLearning, iOS, Tutorials and tagged , , , , , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>