license: > Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.

title: Media

Media

The Media object provides the ability to record and play back audio files on a device.

var media = new Media(src, mediaSuccess, [mediaError], [mediaStatus]);

Note: The current implementation does not adhere to a W3C specification for media capture, and is provided for convenience only. A future implementation will adhere to the latest W3C specification and may deprecate the current APIs.

Parameters

  • src: A URI containing the audio content. (DOMString)
  • mediaSuccess: (Optional) The callback that is invoked after a Media object has completed the current play/record or stop action. (Function)
  • mediaError: (Optional) The callback that is invoked if there was an error. (Function)
  • mediaStatus: (Optional) The callback that is invoked to indicate status changes. (Function)

Methods

Additional ReadOnly Parameters

  • _position: The position within the audio playback in seconds. Not automatically updated during play, call getCurrentPosition to update.
  • _duration: The duration of the media in seconds.

Supported Platforms

  • Android
  • iOS
  • Windows Phone 7 ( Mango )