jQuery Media Plugin

來源:互聯網
上載者:User

標籤:jquery   jquery外掛程式   

jQuery Media 簡介




  Jquery Media Plugin是一款頁面內容嵌套多媒體的外掛程式。支援的大部分的多媒體播放器和多媒體格式,比如:Flash, Quicktime, Windows Media Player, Real Player, MP3, Silverlight, PDF等等。



播放器

檔案格式

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


此外掛程式會把<a>轉化為<div> 從而嵌套多媒體內容。此外掛程式像其它的Jquery外掛程式一樣 簡單易用。


比如:

1、JS調用:

 $(‘.media‘).media();

jQuery Media Plugin選項jQuery Media Plugin包括了很多選項,這些選項控制著多媒體的一些行為(需要特殊設定的屬性詳見)。

其預設選項如下:

// global defautls; override as needed
$.fn.media.defaults = {
    standards:  false,      // use object tags only (no embeds for non-IE browsers)
    canUndo:    true,       // tells plugin to store the original markup so it can be reverted via: $(sel).mediaUndo()
    width:        400,
    height:        400,
    autoplay:    0,               // normalized cross-player setting
    bgColor:    ‘#ffffff‘,     // background color
    params:        { wmode: ‘transparent‘},    // added to object element as param elements; added to embed element as attrs
    attrs:        {},            // added to object and embed elements as attrs
    flvKeyName: ‘file‘,     // key used for object src param (thanks to Andrea Ercolino)
    flashvars:    {},            // added to flash content as flashvars param/attr
    flashVersion:    ‘7‘,    // required flash version
    expressInstaller: null,    // src for express installer

    // default flash video and mp3 player (@see: http://jeroenwijering.com/?item=Flash_Media_Player)
    flvPlayer:     ‘mediaplayer.swf‘,
    mp3Player:     ‘mediaplayer.swf‘,

    // @see http://msdn2.microsoft.com/en-us/library/bb412401.aspx
    silverlight: {
        inplaceInstallPrompt: ‘true‘, // display in-place install prompt?
        isWindowless:          ‘true‘, // windowless mode (false for wrapping markup)
        framerate:              ‘24‘,      // maximum framerate
        version:              ‘0.9‘,  // Silverlight version
        onError:              null,      // onError callback
        onLoad:                  null,   // onLoad callback
        initParams:              null,      // object init params
        userContext:          null      // callback arg passed to the load callback
    }
};


一個簡單的Demo


     <script type="text/javascript">
                    jQuery(function() {
    $(‘.media‘).media({

       width: 190,
        height: 126,

        autoplay: false,//自動播放
        src: ‘2.avi‘  //視頻路徑

    });
            });
        </script>

        <a href="2.avi" class="media">Watch my movie!</a> 


運行效果:

 
    

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.