jquery Multimedia plugin jquery Media plugin use detailed _jquery

Source: Internet
Author: User
Tags silverlight

jquery Media plugin is a jquery based Web Media Player plug-in that supports most network multimedia players and multimedia formats, such as: Flash, Windows Media Player, Real player, Quicktime, Mp3,silverlight, PDF. It automatically replaces a tag with a DIV based on the current script configuration and generates object, embed, or even an IFRAME code, so the compatibility is excellent for generating object or embed,jquery media, which is automatically judged by the current platform. The following code is the result of jquery media generation:

Copy Code code as follows:

<div class= "Media" >
<object width= "450" height= "attr1=" attrValue1 "attr2="
Codebase= "Http://www.apple.com/qtactivex/qtplugin.cab"
Classid= "clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b" >
<param name= "src" value= "Mybettermovie.mov" >
<param name= "AutoPlay" value= "true" >
<param name= "param1" value= "paramValue1" >
<param name= "param2" value= "ParamValue2" >
<embed width= "450" height= "src=" Mybettermovie.mov "true"
attr1= "attrValue1" attr2= "attrValue2" param1= "paramValue1" param2= "ParamValue2"
Pluginspage= "http://www.apple.com/quicktime/download/" > </embed>
</object>
</div>

Specific Use method

HTML markup Code

Copy Code code as follows:

<a class= "Media" href= "Sample.mov" >my Quicktime movie</a>
<a class= "Media" href= "sample.swf" >my Flash movie</a>
<a class= "Media" href= "sample.wma" >my Audio file</a>

Initialize script:

Copy Code code as follows:

$ ('. Media '). Media ();

Options

You can configure parameters by scripting objects or jquery Metadata plugin.

Global default values:

Copy Code code as follows:

$.fn.media.defaults = {
Prefermeta:1,//If True, the tagged meta value takes precedence over the script object
autoplay:0,//standardized cross player settings
bgcolor: ' #ffffff ',//Background color
Params: {},//Added to the object tag as a PARAM element and added to the embed tag as a property
Attrs: {},//Added to object and embed as attributes
Flashvars: {},//Added to Flash as flashvars parameter or property
Flashversion: ' 7 ',//minimum flash version required
Default Flash video and MP3 player//@see: Http://jeroenwijering.com/?item=Flash_Media_Player
Flvplayer: ' mediaplayer.swf ',
Mp3player: ' mediaplayer.swf ',
Silverlight Options//@see http://msdn2.microsoft.com/en-us/library/bb412401.aspx
Silverlight: {
Inplaceinstallprompt: ' true ',///display the installation prompt at the appropriate location
Iswindowless: ' true ',//Windowless mode
Framerate: ' 24 ',//maximum frame rate
Version: ' 0.9 ',//Silverlight version onerror:null,//OnError callback function
Onload:null,//onload callback function
Initparams:null,//object initialization parameters
Usercontext:null//upload parameters to load callback function
}
};

We can also pass in some option arguments when we execute the initialization script, as follows:

Copy Code code as follows:

$ ('. Media '). Media ({width:400, height:300, autoplay:true});

Again like code:

Copy Code code as follows:

$ ('. Media '). Media ({
WIDTH:450,
HEIGHT:250,
Autoplay:true,
SRC: ' Mybettermovie.mov ',
Attrs: {attr1: ' attrValue1 ', attr2: ' AttrValue2 '},//object/embed Attrs
Params: {param1: ' paramValue1 ', param2: ' ParamValue2 '},//Object params/embed Attrs
Caption:false//Supress caption text
});

' src ' option

The SRC option specifies the address of the media file. It does not have a global default value. If the value of the specified SRC option is not displayed, JQuery Media plugin will use the value of the href or src attribute instead.

Player and format

JQuery Media Plugin defaults to the player and format as shown in the following table:

Player

File format

Quicktime

Aif,aiff,aac,au,bmp,gsm,mov,mid, Midi,mpg,mpeg,mp4,m4a,psd,qt,qtif, QIF,QTI,SND,TIF,TIFF,WAV,3G2,3PG

Flash

FLV, MP3, swf

Windows Media Player

ASX, ASF, AVI, WMA, WMV

Real Player

RA, Ram, RM, RPM, RV, SMI, SMIL

Silverlight

Xaml

Iframe

HTML, PDF

The table above shows that the MP3 format is automatically mapped to the Flash Player. The $.fn.media.defaults.mp3player in the global configuration specifies that the MP3 media is played by the mediaplayer.swf file. The SWF file is a small mp3 and flash video player that can be downloaded from here: http://www.longtailvideo.com/players/jw-flv-player/

SWFObject

This script is very common to embed Flash content into a Web page, and you don't have to think about the flash embedding methods on different platforms. But this document is not necessary. If it is loaded, jquery media plugin will use it, whereas jquery media plugin will generate the object/embed tag in its own default way. For more information, refer to: http://code.google.com/p/swfobject/

IFrame Player

By default, the PDF and HTML formats are mapped to an IFRAME. They will appear in the IFRAME rather than in the object/embed tag.

Add or modify a format association

This operation can be implemented by the Mapformat method of the plug-in, such as

$.fn.media.mapformat (' mp3 ', ' QuickTime ');
Available players are: Uicktime, Flash, RealPlayer, Winmedia, Silverlight, and IFRAME, ensuring that the player is able to play the file format associated with it.

Download

Download jquery.media.js files directly, or load historical versions on GitHub

Attention:

This plugin translates <a> into <div> to nest multimedia content. This plugin is as easy to use as other jquery plug-ins.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.