


Detailed explanation of jQuery multimedia plug-in jQuery Media Plugin_jquery
jQuery Media Plugin is a web media player plug-in based on jQuery. It supports most online multimedia players and multimedia formats, such as: Flash, Windows Media Player, Real Player, Quicktime, MP3, Silverlight, PDF. It automatically replaces the a tag with a div based on the current script configuration, and generates object, embed or even iframe code. As for whether to generate object or embed, jQuery Media will automatically determine based on the current platform, so the compatibility is excellent. The following code is the result generated by jQuery Media:
codebase="http://www.apple.com/qtactivex/qtplugin.cab"
classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B">
attr1="attrValue1" attr2="attrValue2" param1="paramValue1" param2="paramValue2"
pluginspage="
http://www.apple.com/quicktime/download/" >
Specific usage
html markup code
Parameters can be configured through script objects or jQuery Metadata Plugin.
Global default:
preferMeta: 1, // If true, the tag's meta value takes precedence over the script object
autoplay: 0, // Standardized cross-player settings
bgColor: '#ffffff', // background color
params: {}, // Add to object tag as param element; add to embed tag as attribute
attrs: {}, // Add to object and embed as attributes
flashvars: {}, // Add to flash as flashvars parameter or attribute
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 // Parameters passed to the load callback function
}
};
We can also pass in some option parameters when executing the initialization script, as shown in the following code:
$('.media').media( { width: 400, height: 300, autoplay: true } );
Another example is the code:
$('.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
Thesrc option specifies the address of the media file. It has no global default value. If the value of the specified src option is not shown, jQuery Media Plugin will use the value of the href or src attribute instead.
Players and formats
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 above table shows that the mp3 format is automatically mapped to the flash player. $.fn.media.defaults.mp3Player in the global configuration specifies that MP3 media is played by the mediaplayer.swf file. The swf file is a small mp3 and flash video player, which can be downloaded from here: http://www.longtailvideo.com/players/jw-flv-player/
SWFObject
This script is very common and is used to embed Flash content into web pages. You don’t need to consider the Flash embedding methods of different platforms. But this file is not required. If it is loaded, jQuery Media Plugin will use it, otherwise jQuery Media Plugin will generate object/embed tags in its own default way. For more information, please refer to: http://code.google.com/p/swfobject/
iframe Player
By default, PDF and HTML formats are mapped to iframes. They will be displayed in an iframe rather than an object/embed tag.
Add or modify 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. Make sure the player can play the file format associated with it.
Download
Download the jquery.media.js file directly, or download the historical version on Github
Note:
This plug-in will convert into

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Detailed explanation of jQuery reference method: Quick start guide jQuery is a popular JavaScript library that is widely used in website development. It simplifies JavaScript programming and provides developers with rich functions and features. This article will introduce jQuery's reference method in detail and provide specific code examples to help readers get started quickly. Introducing jQuery First, we need to introduce the jQuery library into the HTML file. It can be introduced through a CDN link or downloaded

How to use PUT request method in jQuery? In jQuery, the method of sending a PUT request is similar to sending other types of requests, but you need to pay attention to some details and parameter settings. PUT requests are typically used to update resources, such as updating data in a database or updating files on the server. The following is a specific code example using the PUT request method in jQuery. First, make sure you include the jQuery library file, then you can send a PUT request via: $.ajax({u

How to remove the height attribute of an element with jQuery? In front-end development, we often encounter the need to manipulate the height attributes of elements. Sometimes, we may need to dynamically change the height of an element, and sometimes we need to remove the height attribute of an element. This article will introduce how to use jQuery to remove the height attribute of an element and provide specific code examples. Before using jQuery to operate the height attribute, we first need to understand the height attribute in CSS. The height attribute is used to set the height of an element

Title: jQuery Tips: Quickly modify the text of all a tags on the page In web development, we often need to modify and operate elements on the page. When using jQuery, sometimes you need to modify the text content of all a tags in the page at once, which can save time and energy. The following will introduce how to use jQuery to quickly modify the text of all a tags on the page, and give specific code examples. First, we need to introduce the jQuery library file and ensure that the following code is introduced into the page: <

Title: Use jQuery to modify the text content of all a tags. jQuery is a popular JavaScript library that is widely used to handle DOM operations. In web development, we often encounter the need to modify the text content of the link tag (a tag) on the page. This article will explain how to use jQuery to achieve this goal, and provide specific code examples. First, we need to introduce the jQuery library into the page. Add the following code in the HTML file:

How to tell if a jQuery element has a specific attribute? When using jQuery to operate DOM elements, you often encounter situations where you need to determine whether an element has a specific attribute. In this case, we can easily implement this function with the help of the methods provided by jQuery. The following will introduce two commonly used methods to determine whether a jQuery element has specific attributes, and attach specific code examples. Method 1: Use the attr() method and typeof operator // to determine whether the element has a specific attribute

jQuery is a popular JavaScript library that is widely used to handle DOM manipulation and event handling in web pages. In jQuery, the eq() method is used to select elements at a specified index position. The specific usage and application scenarios are as follows. In jQuery, the eq() method selects the element at a specified index position. Index positions start counting from 0, i.e. the index of the first element is 0, the index of the second element is 1, and so on. The syntax of the eq() method is as follows: $("s

jQuery is a popular JavaScript library widely used in web development. During web development, it is often necessary to dynamically add new rows to tables through JavaScript. This article will introduce how to use jQuery to add new rows to a table, and provide specific code examples. First, we need to introduce the jQuery library into the HTML page. The jQuery library can be introduced in the tag through the following code:
