Wordpress 音频播放器 Wordpress audio player with jQuery audioplayer.swf
原文地址:http://justcoding.iteye.com/blog/545978
Wordpress audio player with jQuery
How to use Wordpress audio player (standalone version) with jQuery and jQuery SWFObject (progressive enhancement).
<!-- SECTION "Wordpress audio player with jQuery" [1-272] -->
Example 1: basic
HTML
- <a class="audio" href="audio/reason.mp3">
- Audio: An Electronic Reason
- </a>
Javascript
<!-- SECTION "Example 1: basic" [273-705] -->
- $('.audio').each(function(){
- audio_file = $(this).attr('href');
- $(this).flash(
- {
- swf: 'flash/audioplayer.swf',
- flashvars:
- {
- soundFile: audio_file
- }
- }
- );
- });
Example 2: several synchronized players
Javascript
<!-- SECTION "Example 2: several synchronized players" [706-1488] -->
- // close other audio players
- // called by audio player when click on play button
- function ap_stopAll(player_id)
- {
- $('.audio').each(function(){
- if($(this).attr('href') != player_id)
- {
- $(this).find('object')[0].SetVariable("closePlayer", 1);
- }
- else
- {
- $(this).find('object')[0].SetVariable("closePlayer", 0);
- }
- });
- }
- $(document).ready(function() {
- $('.audio').each(function(){
- audio_file = $(this).attr('href');
- $(this).flash(
- {
- swf: 'flash/audioplayer.swf',
- flashvars:
- {
- playerID: "'" + audio_file + "'",
- soundFile: audio_file
- }
- }
- );
- });
- });
Notes
How it works:
- players are given an id upon initialization
- when click on play button, player calls
ap_stopAll()
with its id as parameter - ap_stopAll(): stops all players but the one with this id
- the id here is the audio file path, but anything else is possible.
<!-- SECTION "Notes" [1489-1786] -->
Example 3: real world
HTML
- <p>
- <a class="audio" href="audio/reason.mp3" id="reason">
- Audio: An Electronic Reason
- </a>
- </p>
- <p>
- <a class="audio" href="audio/sunday.mp3" id="sunday">
- Audio: By Sunday Afternoon
- </a>
- </p>
Javascript
- // close other audio players
- // called by audio player when click on play button
- function ap_stopAll(player_id)
- {
- $('.audio_flash').each(function(){
- if($(this).attr('id') != player_id)
- {
- $(this).find('object')[0].SetVariable("closePlayer", 1);
- }
- else
- {
- $(this).find('object')[0].SetVariable("closePlayer", 0);
- }
- });
- }
- $(document).ready(function() {
- $('.audio').each(function() {
- audio_file = $(this).attr('href');
- audio_title = $(this).text();
- audio_id = $(this).attr('id');
- div = $('<div class="audio_flash" id="' + audio_id + '"></div>');
- $(this).after(div);
- $(this).after(audio_title);
- $(this).remove();
- div.flash(
- {
- swf: 'flash/audioplayer.swf',
- flashvars:
- {
- soundFile: audio_file,
- playerID: "'" + audio_id + "'",
- quality: 'high',
- lefticon: '0xFFFFFF',
- righticon: '0xFFFFFF',
- leftbg: '0x357CCE',
- rightbg: '0x32BD63',
- rightbghover: '0x2C9D54',
- wmode: 'transparent'
- },
- height: 50
- }
- );
- });
- });
<!-- SECTION "Example 3: real world" [1787-3238] -->
Notes
- meaningful HTML: visitors without Javascript get a download link, otherwise it's replaced by plain text and the player
- the appearance can be customized with many options (bottom of the page).
- the default white space before and after the player is reduced by the “height” Flash parameter.
- use of a custom id (set on the HTML link)
<!-- SECTION "Notes" [3239-3682] -->
Download
<!-- SECTION "Download" [3683-] -->
- jquery_audio_player.zip (1.4 MB)
- 下载次数: 53
Wordpress 音频播放器 Wordpress audio player with jQuery audioplayer.swf的更多相关文章
- 【jquery】一款不错的音频播放器——Amazing Audio Player
前段时间分享了一款视频播放器,点击这里.今天介绍一款不错的音频播放器——Amazing Audio Player. 介绍: Amazing Audio Player 是一个使用很方便的 Windows ...
- 基于canvas和Web Audio的音频播放器
wavesurfer.js是一款基于HTML5 canvas和Web Audio的音频播放器插件.通过wavesurfer.js你能够使用它来制作各种HTML5音频播放器,它能够在各种支持 Web A ...
- 最简单的基于FFMPEG+SDL的音频播放器 ver2 (采用SDL2.0)
===================================================== 最简单的基于FFmpeg的音频播放器系列文章列表: <最简单的基于FFMPEG+SDL ...
- 最简单的基于FFMPEG+SDL的音频播放器 ver2 (採用SDL2.0)
===================================================== 最简单的基于FFmpeg的音频播放器系列文章列表: <最简单的基于FFMPEG+SDL ...
- HTML5 音频播放器-Javascript代码(短小精悍)
直接上干货咯! //HTML5 音频播放器 lzpong 2015/01/19 var wavPlayer = function () { if(window.parent.wavPlayer) re ...
- IOS开发之简单音频播放器
今天第一次接触IOS开发的UI部分,之前学OC的时候一直在模拟的使用Target-Action回调模式,今天算是真正的用了一次.为了熟悉一下基本控件的使用方法,和UI部分的回调,下面开发了一个特别简易 ...
- 与众不同 windows phone (14) - Media(媒体)之音频播放器, 视频播放器, 与 Windows Phone 的音乐和视频中心集成
原文:与众不同 windows phone (14) - Media(媒体)之音频播放器, 视频播放器, 与 Windows Phone 的音乐和视频中心集成 [索引页][源码下载] 与众不同 win ...
- Unity3D音频播放器 动态装载组件
大多数在线Unity有关如何只教程Unity在播放音乐.之后如何通过拖动它们无法继续添加音频文件 但有时在游戏中的对象要玩几个声音.这时候我们就需要使用代码控制,拖动推教程AudioClip颂值的方法 ...
- OCiOS开发:音频播放器 AVAudioPlayer
简单介绍 AVAudioPlayer音频播放器可以提供简单的音频播放功能.其头文件包括在AVFoudation.framework中. AVAudioPlayer未提供可视化界面,须要通过其提供的播放 ...
随机推荐
- MFC界面开发(QQ透明皮肤:多层算法,一键适配各种背景 )
http://blog.csdn.net/kent19900125/article/category/1368203/3 QQ透明皮肤:多层算法,一键适配各种背景 . http://blog.csdn ...
- Sort Colors 解答
Question Given an array with n objects colored red, white or blue, sort them so that objects of the ...
- android的init过程分析
前言 Android系统是运作在linux kernal上的,因此它的启动过程也遵循linux的启动过程,当linux内核启动之后,运行的第一个进程是init,这个进程是一个守护进程,它的生命周期贯穿 ...
- PHP MySQL 创建数据库和表 之 Create
创建数据库 CREATE DATABASE 语句用于在 MySQL 中创建数据库. 语法 CREATE DATABASE database_name 为了让 PHP 执行上面的语句,我们必须使用 my ...
- hdu 5610 Baby Ming and Weight lifting
Problem Description Baby Ming is fond of weight lifting. He has a barbell pole(the weight of which c ...
- js埋点(转载)
页面埋点的作用,其实就是用于流量分析.而流量的意思,包含了很多:页面浏览数(PV).独立访问者数量(UV).IP.页面停留时间.页面操作时间.页面访问次数.按钮点击次数.文件下载次数等.而流量分析又有 ...
- Java中基础类库使用
Java中基础类库: 在这里我仅仅介绍几种我个人觉得会常常使用的 1:Object类中的Clone机制仅仅是对对象进行浅层次的克隆,假设须要进行深层次的克隆的话那么就要自己写(详细Clone方法请參考 ...
- Elon Musk:同一时候颠覆几个行业的科技狂人
在苹果著名的"不同凡想"广告中,赞扬了那些改变世界的疯狂家伙们."他们不喜欢墨守成规,也不愿安于现状","他们改变了事物","他们 ...
- zabbix安装及配置(rpm包安装mysql,php,apache,zabbix)
zabbix安装及配置 一.安装mysql.php.apache.zabbix 安装环境: 操作系统:rhel6.3-x86-64 mysql:5.6.23 --官网下载rpm包安装php:5. ...
- 易语言转C#小试牛刀
呵呵,用了几年的易语言,太郁闷了,玩过E的童鞋们懂得,偶然机会尝试C#,现正式投入C#门下. 我会把我学习C#的一些知识和重点,实时发不到我的BLOG中,同想学习C#的童鞋一起成长起来.