音乐播放器源代码
音乐播放器代码
音频播放器代码(1)<EMBED SRC="音乐文件地址">属性有:SRC="FILENAME" 设定音乐文件的路径AUTOSTART=TRUE/FALSE 是否要音乐文件传送完就自动播放,TRUE是要,FALSE是不要,默认为FALSELOOP=TRUE/FALSE 设定播放重复次数,LOOP=6表示重复6次,TRUE表示无限次播放,FALSE播放一次即停止。
STARTIME="分:秒" 设定乐曲的开始播放时间,如20秒后播放写为STARTIME=00:20VOLUME=0-100 设定音量的大小。
如果没设定的话,就用系统的音量。
WIDTH HEIGHT 设定控制面板的大小HIDDEN=TRUE 隐藏控制面板CONTROLS=CONSOLE/SMALLCONSOLE 设定控制面板样子例子:*************************************<html><head><title>播放音乐</title></head><body><EMBED SRC="midi.mid" autostart=true hidden=trueloop=true>作为背景音乐来播放。
</body></html>(2)wma格式音乐播放器代码自动播放代码<P align=center><EMBED name=Player34 pluginspage=/windows/mediapla yer/download/default.asp src=wma格式的歌曲地址width=200 height=50 type=application/x-mplayer2 showstatusbar="-1" AutoStart="-1" PlayCount="0" clicktoplay="-1"></P></EMBED>手动播放代码<P align=center><EMBED name=Player34 pluginspage=/windows/mediapla yer/download/default.asp src=wma格式的歌曲地址width=200 height=50 type=application/x-mplayer2 showstatusbar="-1" AutoStart="0" PlayCount="0" clicktoplay="-1"></P></EMBED>(3)mp3格式音乐播放器代码自动播放代码<P align=center><EMBED name=Player34pluginspage=/windows/mediapla yer/download/default.asp 格式的src=mp3歌曲地址width=200 height=50 type=application/x-mplayer2 showstatusbar="-1" AutoStart="-1" PlayCount="0" clicktoplay="-1"></P></EMBED>手动播放代码<P align=center><EMBED name=Player34 pluginspage=/windows/mediapla yer/download/default.asp src=mp3格式的歌曲地址width=200 height=50 type=application/x-mplayer2 showstatusbar="-1" AutoStart="0" PlayCount="0" clicktoplay="-1"></P></EMBED>(4)rm格式音乐播放器代码自动播放代码<P align=center><EMBED name=Player34 src=rm格式的歌曲地址width=200 height=50 type=application/octet-stream controls="StatusBar,ControlPanel" AutoStart="-1" numloop="0" loop="-1" clicktoplay="-1" nolabels="0" prefetch="0" shuffle="0" _extenty="847" _extentx="9657"></P></EMBED>手动播放代码<P align=center><EMBED name=Player34 src=rm格式的歌曲地址width=200 height=50 type=application/octet-stream controls="StatusBar,ControlPanel" AutoStart="0" numloop="0" loop="-1" clicktoplay="-1" nolabels="0" prefetch="0" shuffle="0" _extenty="847" _extentx="9657"></P></EMBED><html><head><meta name="generator" content="microsoft frontpage 6.0"> <meta name="progid" content="frontpage.editor.document"> <meta http-equiv="content-type" content="text/html; charset=gb2312"><title>插入音乐播放器</title></head>//只需要注意rows="*,21"这句就可以,21表示播放器占的高度为21个象素。
网页音乐播放器代码
网页音乐播放器代码
简介
网页音乐播放器是一个利用 HTML、CSS 和 JavaScript 编写的网页应用程序,能够在网页上播放音乐文件。
它可以通过用户界面提供音乐的播放、暂停、快进、快退等基本操作。
本文将介绍如何使用 HTML、CSS 和 JavaScript 编写一个简单的网页音乐播放器。
准备工作
在开始编写网页音乐播放器代码之前,我们需要准备以下内容:
•音乐文件:准备一些音乐文件(例如 MP3 格式),作为播放器的音乐资源。
•HTML 文件:创建一个 HTML 文件,用于承载网页音乐播放器。
•CSS 文件:创建一个 CSS 文件,用于控制网页音乐播放器的样式。
•JavaScript 文件:创建一个 JavaScript 文件,用于实现网页音乐播放器的功能。
HTML 结构
首先,我们需要定义网页音乐播放器的 HTML 结构。
以下是一个基本的 HTML 结构示例,你可以根据自己的需求进行修改:
```markdown <!DOCTYPE html>
网页音乐播放器
<link rel=。
音乐播放器代码
以下为一款音乐播放器代码,长度(width="960")及高度(height="620")可调,自由切换百度随心听,贝瓦电台,豆瓣电台,音悦TV等多款音乐台。
代码一:<iframe id=TV name=TV frameborder=0 scrolling=no src=/yyzb width=960 height=550></iframe>代码二:<div><embed height="620" allownetworking="internal" width="960" allowscriptaccess="never" loop="-1" invokeurls="false" src="/yyzb" type="audio/mpeg" wmode="transparent"><br/></div>以下为已嵌入音乐播放器代码的网页代码,复制以下代码创建index.html文件上传空间即可播放音乐,友情链接可自己修改。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="/1999/xhtml"><head><link rel="shortcut icon" href="favicon.ico"><link rel="Bookmark" href="favicon.ico"><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><meta name="keywords" content="音乐网"><meta name="description" content="音乐网"><title>音乐网_电视直播网</title><style type="text/css">BODY {SCROLLBAR-FACE-COLOR: #009ace; FONT-SIZE: 12px; SCROLLBAR-HIGHLIGHT-COLOR: #b8e9fa; SCROLLBAR-SHADOW-COLOR: #009aaa; COLOR: #a9c8e4; SCROLLBAR-ARROW-COLOR: #ffffff; SCROLLBAR-TRACK-COLOR: #cccccc; FONT-FAMIL Y: 宋体,Arial,Verdana ; BACKGROUND-COLOR: #8FC8D6; background-repeat: repeat-x}TD {FONT-SIZE: 12px; COLOR: #a9c8e4; LINE-HEIGHT: 140%}A:link {COLOR: #a9c8e4; TEXT-DECORA TION: none}A:visited {COLOR: #a9c8e4; TEXT-DECORA TION: none}A:active {COLOR: #a9c8e4; TEXT-DECORA TION: none}A:hover {COLOR: #00FF00; TEXT-DECORATION: underline}</style><META HTTP-EQUIV="pragma" CONTENT="no-cache"><META http-equiv="Cache-Control" content="no-cache"><META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate"></HEAD><BODY class=bg leftMargin=0 topMargin=0 marginheight="0" marginwidth="0" background="tv/bg.jpg"><TABLE cellSpacing=0 cellPadding=0 width=960 align=center border=0><TBODY><tr><td colspan="2" height=10></td></tr><tr><TD width=120 align=center ><a href=""><img border="0" src="/images/logo.gif" width="180" height="50" alt="电视直播网"></a></TD><TD width=840 align=right><script language="javascript" src="/vcp/getJScode/getJScode.asp?ReferenceID=684929&No=640x60"> </script></TD></TR><tr><td colspan="3" height=10></td></tr><tr><td colspan="2"><div><iframe id=TV name=TV frameborder=0 scrolling=no src=/yyzb width=960 height=550></iframe></div><TABLE cellSpacing=0 cellPadding=0 width=900 align=center border=0><TR><td align=center height=10></td></tr><TR><td align=center height=5></TD></TR><TR><td align=center><font color="#777777">©<br><div class="bottomx"><a><font color=slategray size=4>本站网址/zb 感谢转发微博、空间的朋友!谢谢你们!</a><div><p></p><font color="#777777"><a>友情连接: <a href="/c?s=a485395f&w=616248&c=17666&i=41910&l=0&e=&t=/cps/land/list/ 0" target="_blank"><font color=slategray size=2>蘑菇街</a> <ahref="/" target="_blank"><font color=slategray size=2>4399游戏</a> <a href="/rd/rd.aspx?e=181&adtype=1&unionid=liancaiping&subunionid=&other=&url=http%3A%2F%2Ftopic.moon %2Farticle%2Farticle_show%2F3816%3Ftype%3D0%26cn%3D13960%26other%3Dunionid%3Aliancaiping%7Cadtype%3A1%7Cadid%3A181%26adsiteid%3D10000007" target="_blank"><font color=slategray size=2>梦芭莎</a> <ahref="/?pid=mm_34029538_3439848_11149737" target="_blank"><font color=slategray size=2>爱淘宝</a> <ahref="/?pid=mm_34029538_3439848_11149737&tb_lm_id=l_sczl_sogou_cyg j" target="_blank"><font color=slategray size=2>一淘专享</a> <ahref="/go/act/taoke/ai_crown.php?pid=mm_34029538_3439848_1114973 7&unid=" target="_blank"><font color=slategraysize=2>TOP10店铺</a> <a href="/" target="_blank"><font color=slategray size=2>时光网址导航</a> <ahref="/?tracker_u=1787&uid=91520851657&website_id=521945"target="_blank"><font color=slategray size=2>一号店超市</a></a></font></div><div class="link">本站所有链接均收集自网络免费公开资源,非本站服务器资源,相关权责不由本站负责,若有侵权,请来信告知,本站会尽快删除!<br>Copyright © 2013 /tv/ Email:liancaiping@苏ICP备14004292号-1</font> <a href="/" target="_black" ><fontcolor=red size=2>返回</font></a> <a href="/" target="_black"><font color=red size=2>主页</a> 西部数码<ahref="/index.asp?ReferenceID=684929"target="_blank"><font color=slategray size=2>虚拟主机</a> </a><a href="/jtyy/" target="_blank"><font color=slategray size=2>家庭影院</a><b></TABLE></body></html>。
网页中添加音乐播放器代码
网页中添加音乐播放器代码<embed controller="true" width="300" height="40" src="/lrc/1.wma" border="0" >(一)基本语法:embed src=url说明:embed可以用来插入各种多媒体,格式可以是Midi、Wav、AIFF、AU、MP3等等,Netscape及新版的IE 都支持。
url为音频或视频文件及其路径,可以是相对路径或绝对路径。
示例:<embed src="your.mid">(二)、属性设置:1、自动播放:语法:autostart=true、false说明:该属性规定音频或视频文件是否在下载完之后就自动播放。
true:音乐文件在下载完之后自动播放;false:音乐文件在下载完之后不自动播放。
示例:<embed src="your.mid" autostart=true><embed src="your.mid" autostart=false>2、循环播放:语法:loop=正整数、true、false说明:该属性规定音频或视频文件是否循环及循环次数。
属性值为正整数值时,音频或视频文件的循环次数与正整数值相同;属性值为true时,音频或视频文件循环;属性值为false时,音频或视频文件不循环。
示例:<embed src="your.mid" autostart=true loop=2><embed src="your.mid" autostart=true loop=true><embed src="your.mid" autostart=true loop=false>3、面板显示:语法:hidden=ture、flase说明:该属性规定控制面板是否显示,默认值为flase。
mp3文件播放器源代码
mp3文件播放器源代码头文件代码(resource。
H)//{{NO_DEPENDENCIES}}// Microsoft Developer Studio generated include file.// Used by Script1.rc//#define IDI_ICON1 101#define IDI_MAINICON 101// Next default values for new objects//#ifdef APSTUDIO_INVOKED#ifndef APSTUDIO_READONL Y_SYMBOLS#define _APS_NEXT_RESOURCE_V ALUE 102#define _APS_NEXT_COMMAND_V ALUE 40001#define _APS_NEXT_CONTROL_V ALUE 1000#define _APS_NEXT_SYMED_V ALUE 101#endif#endif主程序代码(main)#include <windows.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <conio.h>#include <dshow.h>#pragma comment( lib, "Strmiids.lib")#pragma comment( lib, "winmm.lib" )#define V_RETURN(x) { hr = x; if( FAILED(hr) ) { return hr; } }////////////////////////////////////////////////////////////////////////////变量定义:IGraphBuilder* pGBuilder;IMediaPosition* pMPos;//////////////////////////////////////////////////////////////////////////HRESULT InitDirectShow(){HRESULT hr;CoInitialize(NULL); //初始化COM//创建各个对象CoCreateInstance(CLSID_FilterGraph, NULL,CLSCTX_INPROC, IID_IGraphBuilder, (void**)&pGBuilder);V_RETURN(pGBuilder->QueryInterface(IID_IMediaControl, (void**)&pMControl));V_RETURN(pGBuilder->QueryInterface(IID_IMediaPosition, (void**)&pMPos));return S_OK;}HRESULT LoadMusicFile(const char *path){HRESULT hr;CHAR strSoundPath[MAX_PATH]; //存储音乐所在路径WCHAR wstrSoundPath[MAX_PATH]; //存储UNICODE形式的路径strcpy(strSoundPath, path);MultiByteToWideChar(CP_ACP, 0, strSoundPath, -1,wstrSoundPath, MAX_PATH);V_RETURN(pGBuilder->RenderFile(wstrSoundPath, NULL)); //调入文件return S_OK;HRESULT Play(){HRESULT hr;//播放MP3的方法十分简单:return S_OK;}HRESULT Stop(){//最后,我们要停止播放音乐并释放各个对象:V_RETURN(pMControl->Stop()); //停止播放return S_OK;}void FreeDirectShow()//释放对象CoUninitialize(); //释放COM}//////////////////////////////////////////////////////////////////////////int main(){char cmd[255] = {NULL}, path[MAX_PATH] = {NULL};if(FAILED(InitDirectShow())){getch();return 1;}while(1){printf("*****这个是用于制作游戏的音乐播放程序,由于时间关系和便于学习我不printf("使用方法--输入以下命令:\n#载入并播放音乐:play\n#停止播放:scanf("%s", cmd);if(!stricmp(cmd, "play")){printf("请输入文件名:");printf("正在处理命令...\n", cmd, path);if(FAILED(LoadMusicFile(path))){getch();path[0] = 0;}else Play();else{printf("正在处理命令...\n", cmd, path);if(!stricmp(cmd, "replay")){Stop();}else if(!stricmp(cmd, "stop"))Stop();else if(!stricmp(cmd, "exit"))goto quit;else{printf("无法识别的命令");getch();}}quit:FreeDirectShow();}。
c语言编写的音乐播放器源代码)
include <windows.h> #include <stdio.h>#include <stdlib.h>#include <string.h>#include <conio.h>unsigned frequency[100];char hight[100];unsigned time[100];unsigned rate;void main(){voidset(unsignedf[],charh[],unsignedt[],int r,int num);void music(unsigned f[],unsigned t[],intnum);int flag=0;FILE *f1;int i,n,menu;char FileName[30];while(1){f1=NULL;i=n=0;printf("本程序采用编码的形式播放音乐。
\n");printf("\n用记事本编辑乐谱,然后通过输入文件名播放音乐\n");printf("乐谱文件可以自创,也可以抄别人的\n");printf("\n现在可以先输入数字再按回车播放音乐:\n");printf("1播放指定音乐music1\n");printf("2播放指定音乐music2\n");printf("3通过程序文件名播放音乐\n");printf("4退出\n");while(1){printf("menu=");scanf("%d",&menu);if(menu==1) {strcpy(FileName,"music1.txt");break;}if(menu==2){strcpy(FileName,"music2.txt");break;}if(menu==3){scanf("%s",FileName);break;}if(menu==4)exit(0);}printf("\n该文件的音乐编码如下:\n");if((f1=fopen(FileName,"r"))==NULL){ printf("不能打开文件!\n");exit(1);}fscanf(f1,"%d",&rate);while(!feof(f1)&&flag!=1){fscanf(f1," %d%c%d",&frequency[i],&hight[i],&time[i]);printf("%d%c%d",frequency[i],hight[i],time[i]);if(time[i]!=-1){i++;n++;}elseflag=1;}printf("\n");set(frequency,hight,time,rate,n);music(frequency,time,n);fclose(f1);}getch();}void set(unsigned f[],char h[],unsigned t[],int r,int num){int i,k;for(i=0;i<num;i++){t[i]=t[i]*r;switch(h[i]){case 'H':k=4;break;case 'M':k=2;break;case 'L':k=1;}switch(f[i]){case 1: f[i]=262*k; break;case 2: f[i]=296*k; break;case 3: f[i]=330*k; break;case 4: f[i]=349*k; break;case 5: f[i]=392*k; break; case 6: f[i]=440*k; break;case 7: f[i]=494*k; break;} }}voidmusic(unsignedf[],unsignedt[],intnum){int i;for(i=0;i<num;i++){Beep(f[i],t[i]);}。
用单片机制作简单音乐播放器代码
if(k==6) return 0xdf; if(k==7) return 0xbf; if(k>=8) return 0x7f; }
uint temp;
uchar jp;//jp 是简谱 //用于产生各种音调 j=0; while(!RI) {
temp=happynewyear[j]; jp=temp/16; //取数的高 4 位 P1=light(jp); if(jp!=0) {
timeh=cuzhi[jp*2]; timel=cuzhi[jp*2+1]; } else {
void main () {
TMOD=0x21; TH1=0xfd; TL1=0xfd; TR1=1; REN=1; SM0=0; SM1=1; while(1) {
if(RI==1) {
RI=0; a=SBUF; if (a==1) {
main1(); EA=0; TR0=0;
} if(a==2) {
ET0=1; song2();
} void song2() {
uint temp;
uchar jp;//jp 是简谱 //用于产生各种音调 j=0; while(!RI) {
temp=wnyhln[k]; jp=temp/16; //取数的高 4 位 P1=light(jp); //LED 灯伴随音调的变化而闪烁 if(jp!=0) {
} void song3() {
uint temp;
uchar jp;//jp 是简谱 //用于产生各种音调 j=0; while(!RI) {
temp=ysysljj[h]; jp=temp/16; //取数的高 4 位 P1=light(jp); if(jp!=0) {
MP3播放器源代码
MP3播放器源代码#Region#AutoIt3Wrapper_icon=HoneyTao.ico#AutoIt3Wrapper_Compression=4#AutoIt3Wrapper_Res_Description=WinXP & Win7#AutoIt3Wrapper_Res_LegalCopyright=K丶Q 製作。
#AutoIt3Wrapper_Res_Field=产品版本|1.0.0.0#AutoIt3Wrapper_Res_Field=产品名称|PeachPlayer#AutoIt3Wrapper_Res_Field=公司|K丶Q#AutoIt3Wrapper_Res_Field=内部名称|cALl Me KQ。
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0#AutoIt3Wrapper_Res_Field=源文件名|PeachPlayer.exe#EndRegion#include <ButtonConstants.au3>#include <ComboConstants.au3>#Include <GuiComboBoxEx.au3>#include <GUIConstantsEx.au3>#include <ProgressConstants.au3>#include <StaticConstants.au3>#include <WindowsConstants.au3>#include "Bass.au3"#include "GUIEnhance.au3"Local $ProcessList = ProcessList(@ScriptName)If $ProcessList[0][0] > 1 ThenMsgBox(0+16,"错误","请勿多次运行本程序")ExitEndIfGlobal $Happy1 = @TempDir & "\Happy1.jpg",$Happy2 = @TempDir & "\Happy2.jpg",$Peach1 = @TempDir & "\Peach1.jpg",$Peach2 = @TempDir & "\Peach2.jpg",$BassDll = @ScriptDir & "\bass.dll",$Icon = @TempDir & "\HoneyTao.dll",$SkinDll = @ScriptDir & "\SkinCrafterDll.dll",$Skin = @ScriptDir & "\Style.skf",$Dll,$MusicHandle,$PicFileInstall("Happy1.jpg",$Happy1,1)FileInstall("Happy2.jpg",$Happy2,1)FileInstall("Peach1.jpg",$Peach1,1)FileInstall("Peach2.jpg",$Peach2,1)FileInstall("HoneyTao.dll",$Icon,1)_BASS_Startup("bass.dll")_BASS_Init(0, -1, 44100, 0, "")If @error Then Exit$Gui = GUICreate("", 500, 395, -1, -1)_SkinGUI($SkinDll,$Skin,$Gui)$Pic = GUICtrlCreatePic("", 0, 0, 500, 331)If @MON & @MDAY = "1201" ThenGUICtrlSetImage($Pic,$Happy1)ElseGUICtrlSetImage($Pic,$Peach1)EndIf$Combo = GUICtrlCreateCombo("", 10, 340, 276, 25)_GUICtrlComboBox_SetDroppedWidth($Combo, 495)File(@ScriptDir)$Progress = GUICtrlCreateProgress(10, 366, 276, 20)$Stop = GUICtrlCreateIcon($Icon, 2, 295, 340, 48, 48)GUICtrlSetTip(-1,"停止")GUICtrlSetCursor (-1, 0)$First = GUICtrlCreateIcon($Icon, 3, 345, 340, 48, 48)GUICtrlSetTip(-1,"上一张图片")GUICtrlSetCursor (-1, 0)$Play = GUICtrlCreateIcon($Icon, 1, 395, 340, 48, 48)GUICtrlSetTip(-1,"播放")GUICtrlSetCursor (-1, 0)$Second = GUICtrlCreateIcon($Icon, 4, 445, 340, 48, 48)GUICtrlSetTip(-1,"下一张图片")GUICtrlSetCursor (-1, 0)_GUIEnhanceAnimateWin($Gui,1000,$GUI_EN_ANI_FADEIN)GUISetState(@SW_SHOW)If @MON & @MDAY = "1201" Then_GUIEnhanceAnimateTitle($Gui,"桃桃,祝妳生日快乐",$GUI_EN_TITLE_DROP) Else_GUIEnhanceAnimateTitle($Gui,"PeachPlayer",$GUI_EN_TITLE_DROP)EndIfWhile 1$Msg = GUIGetMsg()Switch $MsgCase $GUI_EVENT_CLOSEQuit()Case $ComboPlayMusic()Case $StopStopMusic()Case $FirstIf @MON & @MDAY = "1201" ThenGUICtrlSetImage($Pic,$Happy2)ElseGUICtrlSetImage($Pic,$Peach2)EndIfCase $PlayPlayMusic()Case $SecondIf @MON & @MDAY = "1201" ThenGUICtrlSetImage($Pic,$Happy1)ElseGUICtrlSetImage($Pic,$Peach1)EndIfEndSwitchWEndFunc _SkinGUI($SkincrafterDll, $SkincrafterSkin, $Handle)$Dll = DllOpen($SkincrafterDll)DllCall($Dll, "int:cdecl", "InitLicenKeys", "wstr", "SKINCRAFTER", "wstr", "", "wstr", "support@", "wstr", "DEMOSKINCRAFTERLICENCE")DllCall($Dll, "int:cdecl", "InitDecoration", "int", 1)DllCall($Dll, "int:cdecl", "LoadSkinFromFile", "wstr", $SkincrafterSkin)DllCall($Dll, "int:cdecl", "DecorateAs", "int", $Handle, "int", 25)DllCall($Dll, "int:cdecl", "ApplySkin")EndFuncFunc File($SearchDir)$FFArchiveFile = FileFindFirstFile($SearchDir & "\*.*")If $FFArchiveFile = -1 Then Return -1While 1$FNArchiveFile = FileFindNextFile($FFArchiveFile)If @error = 1 ThenFileClose($FFArchiveFile)Return 0ElseIf $FNArchiveFile = "." Or $FNArchiveFile = ".." ThenContinueLoopElseIf StringInStr(FileGetAttrib($SearchDir & "\" & $FNArchiveFile),"D") ThenFile($SearchDir & "\" & $FNArchiveFile)EndIfIf StringRight($FNArchiveFile,4) = ".mp3" ThenIf $FNArchiveFile = "Happy Birthday To You.mp3" ThenGUICtrlSetData($Combo,$SearchDir & "\" & $FNArchiveFile,$SearchDir & "\" & $FNArchiveFile)ElseGUICtrlSetData($Combo,$SearchDir & "\" & $FNArchiveFile)EndIfEndIfWEndEndFunc ;==>FileFunc ProgressStatus()Local $Pos = _BASS_ChannelGetPosition($MusicHandle,$BASS_POS_BYTE),$Length =_BASS_ChannelGetLength($MusicHandle,$BASS_POS_BYTE)If ($Pos >= $Length And $Length > 0) Or _BASS_ChannelIsActive($MusicHandle) = 0 Then_BASS_ChannelStop($MusicHandle)GUICtrlSetData($Progress,0)GUICtrlSetImage($Play,$Icon,1)GUICtrlSetTip($Play,"播放")AdlibUnRegister("ProgressStatus")ElseGUICtrlSetData($Progress,Int($Pos / $Length * 100))EndIfEndFunc ;==>ProgressStatusFunc PlayMusic()Local $MusicFile = GUICtrlRead($Combo)If _BASS_ChannelIsActive($MusicHandle) = 0 Then ;当没有播放时则播放音乐$MusicHandle = _BASS_StreamCreateFile(False,$MusicFile,0,0,0)_BASS_ChannelPlay($MusicHandle,1)GUICtrlSetImage($Play,$Icon,5)GUICtrlSetTip($Play,"暂停")ElseIf _BASS_ChannelIsActive($MusicHandle) = 1 Then ;当返回状态为1,即正在播放时$InFo = _BASS_ChannelGetInfo($MusicHandle)If $InFo[7] <> $MusicFile Then ;正在播放的音乐名与所选的文件不相同的话,即当前播放新文件If _BASS_ChannelStop($MusicHandle) Then$MusicHandle = _BASS_StreamCreateFile(False,$MusicFile,0,0,0)_BASS_ChannelPlay($MusicHandle,1)GUICtrlSetImage($Play,$Icon,5)GUICtrlSetTip($Play,"暂停")EndIfElse ;此时判断为暂停_BASS_ChannelPause($MusicHandle)GUICtrlSetImage($Play,$Icon,1)GUICtrlSetTip($Play,"播放")EndIfElseIf _BASS_ChannelIsActive($MusicHandle) = 3 Then ;当返回状态为3,即暂停播放时_BASS_ChannelPlay($MusicHandle,0)GUICtrlSetImage($Play,$Icon,5)GUICtrlSetTip($Play,"暂停")EndIfAdlibRegister("ProgressStatus", 100)ProgressStatus()EndFunc ;==>PlayMusicFunc StopMusic()_BASS_ChannelStop($MusicHandle)GUICtrlSetData($Progress,0)GUICtrlSetImage($Play,$Icon,1)GUICtrlSetTip($Play,"播放")EndFunc ;==>StopMusicFunc Quit()GUISetState(@SW_HIDE)_Bass_Free()If FileExists($Happy1) = 1 Then FileDelete($Happy1) If FileExists($Happy2) = 1 Then FileDelete($Happy2) If FileExists($Peach1) = 1 Then FileDelete($Peach1) If FileExists($Peach2) = 1 Then FileDelete($Peach2) If FileExists($Icon) = 1 Then FileDelete($Icon) DllCall($Dll, "int:cdecl", "DeInitDecoration") DllCall($Dll, "int:cdecl", "RemoveSkin")DllClose($Dll)ExitEndFunc ;==>Qui。
android音乐播放器---源代码
android:background="@drawable/bg1">
<TextView android:layout_x="93px" android:layout_height="wrap_content"
<TextView android:layout_x="145px" android:layout_height="wrap_content"
android:text="" android:layout_y="65px" android:id="@+id/current_music"
android:textSize="18px" android:textColor="#C0FF3E"
<dimen name="button_size">40px</dimen>
</resources>
color.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="white">#ffffff</color>
android:layout_height="wrap_content" />
基于python实现音乐播放器代码实例
基于python实现⾳乐播放器代码实例核⼼播放模块(pygame内核)import timeimport pygameimport easygui as guifile = r'D:\CloudMusic\G.E.M.邓紫棋,艾热 - 光年之外 (热爱版).mp3' #这⾥为⾳乐⽂件路径pygame.mixer.init()gui.msgbox("正在播放"+file)track = pygame.mixer.music.load(file)pygame.mixer.music.play()time.sleep(240)pygame.mixer.music.stop()完整版源代码:import osimport tkinterimport tkinter.filedialogimport timeimport threadingimport pygame #实现⾳频播放#第⼀步:搭建界⾯root = ()root.title('封亚飞的⾳乐播放器v1.0')#设置窗⼝⼤⼩和屏幕绝对位置root.geometry('460x600+500+100')#固定窗⼝⼤⼩,设置窗⼝不可拉伸root.resizable(False,False)folder = '' # 接收⽂件路径默认为空res=[] #num=0now_music = ''#第⼆步:实现功能def buttonChooseClick():#添加⽂件函数global folderglobal res#如果folder不为空,则····if not folder:folder = tkinter.filedialog.askdirectory() #选择⽬录,返回⽬录名musics = [folder + '\\' + musicfor music in os.listdir(folder)\\if music.endswith(('.mp3','.m4a','.wav','.ogg')) ]ret = []for i in musics:ret.append(i.split('\\')[1:])res.append(i.replace("\\",'/'))var2 = tkinter.StringVar()var2.set(ret)lb = tkinter.Listbox(root,listvariable=var2)lb.place(x=50,y=220,width=260,height=300)if not folder:returnglobal playingplaying = True#根据情况禁⽤或启⽤相应按钮bottonPlay['state'] = 'normal'bottonStop['state'] = 'normal'#buttonPause['state'] = 'normal'pause_resume.set('播放')#播放⾳乐函数def play():#初始化混响设备if len(res):pygame.mixer.init()global numwhile playing:if not pygame.mixer.music.get_busy():#随机播放nextMusci = res[num]print(nextMusci)print(num)pygame.mixer.music.load(nextMusci.encode())#播放⼀次pygame.mixer.music.play(1)#print(len(res)-1)if len(res) - 1 ==num:num=0else:num +=1nextMusci = nextMusci.split("\\")[1:]musicName.set('playing....'+''.join(nextMusci))else:time.sleep(0.1)#点击播放函数def bottonPlayClik():bottonNext['state']='normal'bottonPrev['state']='normal'#选择要播放的⾳乐⽂件夹if pause_resume.get() == '播放':pause_resume.set('暂停')global folderif not folder:#选择⽬录,返回⽬录名folder = tkinter.filedialog.askdirectory()if not folder:returnglobal playingplaying = True#创建⼀个进程来播放⾳乐,当前主进程⽤来接收⽤户操作 t = threading.Thread(target=play)t.start()elif pause_resume.get() == '暂停':pygame.mixer.music.pause()pause_resume.set('继续')elif pause_resume.get()=='继续':pygame.mixer.music.unpause()pause_resume.set('暂停')#停⽌播放函数def bottonStopClik():global playingplaying = Falsepygame.mixer.music.stop()#下⼀⾸函数def bottonNextClik():global playingplaying = Falsepygame.mixer.music.stop()global numif len(res) == num:num=0playing = Trueglobal tt = threading.Thread(target=play)t.start()#上⼀⾸函数def bottonPrevClik():global playingplaying=Falsepygame.mixer.music.stop()global numif num==0:num=len(res)-2elif num ==len(res)-1:num-=2else:num-=2print(num)playing = Trueglobal tt.threading.Thread(target=play)t.start()#关闭窗⼝函数def closeWindows():global playingplaying=Falsetime.sleep(0.3)try:pygame.mixer.music.stop()pygame.mixer.quit()except:passroot.destroy()#声⾳控制函数def control_voice(value=0.5):pygame.mixer.music.set_volume(float(value))#添加按钮bottonChoose=tkinter.Button(root,text='添加',command=buttonChooseClick) #按钮布局bottonChoose.place(x=50,y=50,width=50,height=20)#播放按钮跟踪变量值的变化pause_resume=tkinter.StringVar(root,value='播放')bottonPlay=tkinter.Button(root,textvariable=pause_resume,command=bottonPlayClik)#按钮布局bottonPlay.place(x=120,y=50,width=50,height=20)bottonPlay['state'] = 'disabled' #未添加⽂件(刚启动)时禁⽤#停⽌播放bottonStop = tkinter.Button(root,text='停⽌')#按钮布局bottonStop.place(x=50,y=130,width=50,height=20)#下⼀⾸bottonNext = tkinter.Button(root,text='下⼀⾸',command=bottonNextClik)#按钮布局bottonNext.place(x=50,y=100,width=50,height=20)bottonNext['state']='disabled'#上⼀⾸bottonPrev = tkinter.Button(root,text='上⼀⾸',command=bottonPrevClik)#按钮布局bottonPrev.place(x=120,y=100,width=50,height=20)bottonPrev['state']='disabled'#显⽰内容--播放状态musicName = tkinter.StringVar(root,value='暂时没有播放⾳乐...')labelName = bel(root,textvariable=musicName)labelName.place(x=10,y=20,width=260,height=20)#显⽰内容--⾳量调节s = tkinter.Scale(root,label='⾳量',from_=0,to=1,orient=tkinter.HORIZONTAL,length=240,showvalue=0,tickinterval=2,resolution=0.1,command=control_voice)s.place(x=50,y=150,width=200)#关闭窗⼝root.protocol("WM_DELETE_WINDOW",closeWindows)#启⽤消息循环:显⽰出上⼀步创建的画板对象root.mainloop()以上就是本⽂的全部内容,希望对⼤家的学习有所帮助,也希望⼤家多多⽀持。
C WIN32音乐播放器源代码(主要代码).cpp
BOOL Main_Dialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
//*******************************************************************************************************************
BOOL WINAPI Main_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
M_MUSIC(hwnd,TEXT("close"),numberup);
--number;
M_UPDOWN(hwnd);
M_MUSIC(hwnd,TEXT("play"),number);
}
break;
case IDC_PAUSE:
{
//*******************************************************************************************************************// 其它情况
default:
break;
}
#include "stdafx.h"
#include <windows.h>
#include <windowsx.h>
小小玩意儿,单片机、SD卡、3310LCD做的音乐播放器 源代码
}
/************ SD卡初始化 ************/
uchar sd_init(void)
{
uchar time, temp;
uchar pcmd[6] = {0x41,0x00,0x00,0x00,0x00,0xff};
}
/******* 读取一扇区的声音数据 *********/
uchar sd_read_sector(uchar data *ad)
{
uchar temp, time, pcmd[6];
uint j = 0;
pcmd[0] = 0x51;
pcmd[1] = *ad;
/********* 通用延时函数 ***********/
void delay(uint i)
{
while(i--);
}
/******** SD写入一个字节 **********/
void spi_write(uchar x)
{ //不采用循环结构是为了提高处理速度
{
uchar temp, time, x, pcmd[6];
uint j = 0;
pcmd[0] = 0x51;
pcmd[1] = *ad;
pcmd[2] = *(++ad);
pcmd[3] = *(++ad);
pcmd[4] = 0;
pcmd[2] = *(++ad);
pcmd[3] = *(++ad);
pcmd[4] = 0;
pcmd[5] = 0xff;
基于java的音乐播放器的设计(源代码+实验报告)
主类MUSICPLAYER类:import java.util.*;import javax.swing.JSlider;import java.awt.BorderLayout;import java.awt.FlowLayout;import java.awt.Point;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.MouseAdapter;import java.awt.event.MouseEvent;import java.io.BufferedOutputStream;import java.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.IOException;import java.io.ObjectInputStream;import java.io.ObjectOutputStream;import java.io.Serializable;import javax.media.ControllerEvent;import javax.media.ControllerListener;import javax.media.EndOfMediaEvent;import javax.media.Manager;import javax.media.MediaLocator;import javax.media.NoPlayerException;import javax.media.Player;import javax.media.PrefetchCompleteEvent;import javax.media.Time;import javax.swing.ButtonGroup;import javax.swing.DefaultListModel;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JFileChooser;import javax.swing.JFrame;import javax.swing.JList;import javax.swing.JMenu;import javax.swing.JMenuBar;import javax.swing.JMenuItem;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JRadioButtonMenuItem;import javax.swing.JScrollBar;import javax.swing.JScrollPane;import javax.swing.filechooser.FileNameExtensionFilter;public class MusicPlayer implements ActionListener, Serializable,ControllerListener {private static final long serialVersionUID = 1L;private JFrame frame = null;private JPanel controlPanel = null;private JButton btnPlay = null;private JButton btnPre = null;private JButton btnNext = null;private JScrollPane listPane = null;private JList list = null;private DefaultListModel listModel = null;private JMenuBar menubar = null;private JMenu menuFile = null, menuAbout = null, menuMode = null;private JMenuItem itemOpen, itemOpens, itemExit, itemAbout;private JRadioButtonMenuItem itemSingle, itemSequence ,itemRandom;private ListItem currentItem = null;private static Player player = null;private boolean isPause = false;private int mode;private int currentIndex;private ImageIcon iconPlay = new ImageIcon("d:\\1.jpg");private ImageIcon iconPre = new ImageIcon("d:\\3.jpg");private ImageIcon iconNext = new ImageIcon("d:\\2.jpg");private ImageIcon iconPause = new ImageIcon("d:\\4.jpg");public static void main(String[] args){new MusicPlayer();}public MusicPlayer(){init();}public void init(){frame = new JFrame();frame.setTitle("音乐播放器");frame.setSize(400, 300);frame.setResizable(false);frame.setLocationRelativeTo(null);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);menubar = new JMenuBar();menuFile = new JMenu("文件");menuAbout = new JMenu("关于");menuMode = new JMenu("播放模式");itemOpen = new JMenuItem("添加文件");itemOpens = new JMenuItem("添加文件夹");itemExit = new JMenuItem("退出");itemAbout = new JMenuItem("关于");itemOpen.addActionListener(this);itemOpens.addActionListener(this);itemExit.addActionListener(this);itemAbout.addActionListener(this);itemSequence = new JRadioButtonMenuItem("顺序播放"); itemSequence.setSelected(true);itemSingle = new JRadioButtonMenuItem("单曲循环"); itemSequence.addActionListener(this);itemRandom = new JRadioButtonMenuItem("随机播放"); itemRandom.addActionListener(this);itemSingle.addActionListener(this);ButtonGroup bg = new ButtonGroup();bg.add(itemRandom);bg.add(itemSequence);bg.add(itemSingle);menuFile.add(itemOpen);menuFile.add(itemOpens);menuFile.add(itemExit);menuAbout.add(itemAbout);menuMode.add(itemSequence);menuMode.add(itemSingle);menuMode.add(itemRandom);menubar.add(menuFile);menubar.add(menuAbout);menubar.add(menuMode);frame.setJMenuBar(menubar);frame.setLayout(new BorderLayout());controlPanel = new JPanel();controlPanel.setLayout(new FlowLayout());btnPlay = new JButton(iconPlay);btnPre = new JButton(iconPre);btnNext = new JButton(iconNext);btnPlay.addActionListener(this);btnPre.addActionListener(this);btnNext.addActionListener(this);controlPanel.add(btnPre);controlPanel.add(btnPlay);controlPanel.add(btnNext);listPane = new JScrollPane();listModel = load();list = new JList(listModel);if (list.getSelectedIndex() == -1 && listModel.size() > 0){currentItem = (ListItem) listModel.get(0);list.setSelectedIndex(0);currentIndex=0;}listPane.getViewport().add(list);list.addMouseListener(new MouseAdapter(){public void mouseClicked(MouseEvent e){if (e.getClickCount() == 2){if(player!=null){player.close();btnPlay.setIcon(iconPlay);}currentIndex = list.locationToIndex(e.getPoint());currentItem = (ListItem) listModel.get(currentIndex);list.setSelectedIndex(currentIndex);play();}}});frame.setLayout(new BorderLayout());frame.add(controlPanel, BorderLayout.NORTH);frame.add(listPane, BorderLayout.CENTER);frame.setVisible(true);};public void actionPerformed(ActionEvent e){if (e.getSource() == itemOpen){// add filesJFileChooser jfc = new JFileChooser();FileNameExtensionFilter filter = new FileNameExtensionFilter("音乐文件", "mp3", "wav");jfc.setFileFilter(filter);jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);jfc.setMultiSelectionEnabled(true);if (jfc.showOpenDialog(frame) == JFileChooser.APPROVE_OPTION){File[] files = jfc.getSelectedFiles();for (File f : files){ListItem item = new ListItem(f.getName(), f.getAbsolutePath());listModel.addElement(item);}}}else if (e.getSource() == itemOpens){// add files in a directoryJFileChooser jfc = new JFileChooser();jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);if (jfc.showOpenDialog(frame) == JFileChooser.APPROVE_OPTION){File directory = jfc.getSelectedFile();File[] files = directory.listFiles(new java.io.FileFilter(){public boolean accept(File f){if (f.getName().toLowerCase().endsWith(".mp3")|| f.getName().toLowerCase().endsWith(".wav"))return true;return false;}});for (File file : files){ListItem item = new ListItem(file.getName(), file.getAbsolutePath());listModel.addElement(item);}save(listModel);}}else if (e.getSource() == itemExit){System.exit(0);}else if (e.getSource() == itemAbout){JOptionPane.showMessageDialog(frame, "作者:陆鑫");}else if (e.getSource() == btnPlay){// play or pauseplay();}else if (e.getSource() == btnPre){pre();}else if (e.getSource() == btnNext){// next musicnext();}else if (e.getSource() == itemSequence){mode = 0;}else if (e.getSource() == itemSingle){mode = 1;}else if (e.getSource() == itemRandom){mode = 2;}}// play control/*** 播放*/public void play(){if (btnPlay.getIcon() == iconPlay){if (isPause){player.start();System.out.println("暂停结束");isPause = false;}else{try{player = Manager.createPlayer(new MediaLocator("file:"+ currentItem.getPath()));player.addControllerListener(this); // 提取媒体内容player.prefetch();}catch (NoPlayerException e1){e1.printStackTrace();}catch (IOException e1){e1.printStackTrace();}}btnPlay.setIcon(iconPause);}else{player.stop();isPause = true;System.out.println("暂停");btnPlay.setIcon(iconPlay);}}public void next(){if (currentIndex == listModel.getSize() - 1){currentIndex = 0;}else{currentIndex++;}currentItem = (ListItem) listModel.get(currentIndex);list.setSelectedIndex(currentIndex);Point p = list.indexToLocation(currentIndex);JScrollBar jScrollBar = listPane.getVerticalScrollBar();// 获得垂直转动条jScrollBar.setValue(p.y);// 设置垂直转动条位置btnPlay.setIcon(iconPlay);if (player != null)player.close();isPause = false;play();}public void rand(){list.setSelectedIndex((int)(Math.random()%(listModel.getSize()-1)));Pointp=list.indexToLocation((int)(Math.random()%(listModel.getSize()-1)));JScrollBar jScrollBar = listPane.getVerticalScrollBar();jScrollBar.setValue(p.y);btnPlay.setIcon(iconPlay);if (player != null)player.close();isPause = false;play();}public void pre(){if (currentIndex == 0){currentIndex = listModel.getSize() - 1;}else{currentIndex--;}currentItem = (ListItem) listModel.get(currentIndex);list.setSelectedIndex(currentIndex);Point p = list.indexToLocation(currentIndex);JScrollBar jScrollBar = listPane.getVerticalScrollBar();// 获得垂直转动条jScrollBar.setValue(p.y);// 设置垂直转动条位置btnPlay.setIcon(iconPlay);if (player != null){player.close();}isPause = false;play();}// end play controlpublic DefaultListModel load(){File file = new File("list.lst");DefaultListModel dlm = new DefaultListModel();if (file.exists()){try{ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file));Integer size = (Integer) ois.readObject();if (size != 0){for (int i = 0; i < size; i++){ListItem item = (ListItem) ois.readObject();dlm.addElement(item);}}ois.close();return dlm;}catch (FileNotFoundException e){e.printStackTrace();}catch (IOException e){e.printStackTrace();}catch (ClassNotFoundException e){e.printStackTrace();}}return dlm;}public void save(DefaultListModel dlm){try{ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream("list.lst")));Integer size = dlm.getSize();oos.writeObject(size);for (int i = 0; i < size; i++){ListItem item = (ListItem) dlm.get(i);oos.writeObject(item);}oos.close();}catch (Exception e){e.printStackTrace();}}public void controllerUpdate(ControllerEvent e) {if (e instanceof EndOfMediaEvent){if (mode == 0){// 顺序播放System.out.println("顺序播放");next();}else if (mode == 1){ // 单曲循环System.out.println("播放结束");player.setMediaTime(new Time(0));System.out.println("单曲循环");player.start();}else if (mode == 2){System.out.println("随机播放");rand();}return;}// 当提取媒体的内容结束if (e instanceof PrefetchCompleteEvent){System.out.println("开始播放");player.start();return;}}}LISTITEM类import java.io.Serializable;public class ListItem implements Serializable{private static final long serialVersionUID = 1L;private String name;private String path;public ListItem(){}public ListItem(String name, String path){ = name;this.path = path;}public String getName(){return name;}public void setName(String name){ = name;}public String getPath(){return path;}public void setPath(String path){this.path = path;}public String toString(){return name;}}基于java的音乐播放器的设计摘要:在信息,技术高速发展的今天,多媒体技术也越来越受到人们的重视。
音频播放器代码-代码大全
音频播放器代码-代码大全播放器样式和代码1.简易播放器一(手动) 主要音频格式:rm,ra,ram,mp3简易播放器(自动播放)代码,提取方法:右击,全选,复制<center><embed src="音频绝对地址" width=200 height=30 controls=ControlPanel loop=true autostart=true volume=100 type=audio/x-pn-realaudio-plugin Initfn=load-types mime-types=mime.types></center>2.简易播放器二(手动) 主要格式wma,mp3简易播放器二(自动播放)代码.提取方法:右击,全选,复制<center><EMBED style="FILTER: xray(); WIDTH: 200px; HEIGHT: 30px" src="音频绝对地址" type=audio/x-mpegurl volume="0" loop="-1" autostart="true" allowscriptaccess="never"></EMBED></center>3.多功能播放器(手动)各类格式音视频 (rm等除外)多功能播放器(自动播放)代码,提取方法:右击,全选,复制(如果是视频文件,请将以下代码里的值改为height=350)<center><OBJECT id=phx height=45 width=350 classid=clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6><PARAM NAME="URL" VALUE="音视频绝对地址"><PARAM NAME="rate" VALUE="1"><PARAM NAME="balance" VALUE="0"><PARAM NAME="currentPosition" VALUE="0"><PARAM NAME="defaultFrame" VALUE=""><PARAM NAME="playCount" VALUE="1"><PARAM NAME="autoStart" VALUE="-1"><PARAM NAME="currentMarker" VALUE="0"><PARAM NAME="invokeURLs" VALUE="-1"><PARAM NAME="baseURL" VALUE=""><PARAM NAME="volume" VALUE="78"><PARAM NAME="mute" VALUE="0"><PARAM NAME="uiMode"VALUE="full"><PARAM NAME="stretchToFit" VALUE="0"><PARAM NAME="windowlessVideo" VALUE="0"><PARAM NAME="enabled" VALUE="-1"><PARAM NAME="enableContextMenu" VALUE="-1"><PARAM NAME="fullScreen" VALUE="0"><PARAM NAME="SAMIStyle" VALUE=""><PARAM NAME="SAMILang" VALUE=""><PARAM NAME="SAMIFilename" VALUE=""><PARAM NAME="captioningID" VALUE=""><PARAM NAME="enableErrorDialogs" VALUE="0"><PARAM NAME="_cx" VALUE="8811"><PARAM NAME="_cy" VALUE="1217"></OBJECT></CENTER>4.微软简易播放器(手动)音频格式:mp3,wma等微软播放器(自动播放)代码,提取方法:右击,全选,复制<P align=center><EMBED src="音频绝对地址" width=320 height=45 type=audio/mpeg autostart="0"></EMBED></P>5.标签型播放器(手动播放)音频格式 mp3,wma标签型播放器(自动播放)代码:代码提取方法:右击,全选,复制<DIV align=center><EMBED src="音频绝对地址" width=300 height=140 type=audio/x-ms-wma balance="true" showpositioncontrols="true" showtracker="true" showaudiocontrols="true" showcontrols="true" showstatusbar="true" showdisplay="true" displaysize="0" volume="100" autosize="false" autostart="true" animationatstart="false" transparentatstart="true"></div>注:1,以上显示的播放器均设置为手动播放,即:autostart="0".如需自动播放请设置autostart="true".2,以上各播放器代码里均设置为自动播放,即.autostart="true",如需手动播放请设置autostart="0"样式和代码1.简易播放器一(手动) 主要音频格式:rm,ra,ram,mp3简易播放器(自动播放)代码,提取方法:右击,全选,复制<center><embed src="音频绝对地址" width=200 height=30 controls=ControlPanel loop=true autostart=true volume=100 type=audio/x-pn-realaudio-plugin Initfn=load-types mime-types=mime.types></center>2.简易播放器二(手动) 主要格式wma,mp3简易播放器二(自动播放)代码.提取方法:右击,全选,复制<center><EMBED style="FILTER: xray(); WIDTH: 200px; HEIGHT: 30px" src="音频绝对地址" type=audio/x-mpegurl volume="0" loop="-1" autostart="true" allowscriptaccess="never"></EMBED></center>3.多功能播放器(手动)各类格式音视频 (rm等除外)多功能播放器(自动播放)代码,提取方法:右击,全选,复制(如果是视频文件,请将以下代码里的值改为height=350)<center><OBJECT id=phx height=45 width=350 classid=clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6><PARAM NAME="URL" VALUE="音视频绝对地址"><PARAM NAME="rate" VALUE="1"><PARAM NAME="balance" VALUE="0"><PARAM NAME="currentPosition" VALUE="0"><PARAM NAME="defaultFrame" VALUE=""><PARAM NAME="playCount" VALUE="1"><PARAM NAME="autoStart" VALUE="-1"><PARAM NAME="currentMarker" VALUE="0"><PARAM NAME="invokeURLs" VALUE="-1"><PARAM NAME="baseURL" VALUE=""><PARAM NAME="volume" VALUE="78"><PARAM NAME="mute" VALUE="0"><PARAM NAME="uiMode" VALUE="full"><PARAM NAME="stretchToFit" VALUE="0"><PARAM NAME="windowlessVideo"VALUE="0"><PARAM NAME="enabled" VALUE="-1"><PARAM NAME="enableContextMenu" VALUE="-1"><PARAM NAME="fullScreen" VALUE="0"><PARAM NAME="SAMIStyle" VALUE=""><PARAM NAME="SAMILang" VALUE=""><PARAM NAME="SAMIFilename" VALUE=""><PARAM NAME="captioningID" VALUE=""><PARAM NAME="enableErrorDialogs" VALUE="0"><PARAM NAME="_cx" VALUE="8811"><PARAM NAME="_cy" VALUE="1217"></OBJECT></CENTER>4.微软简易播放器(手动)音频格式:mp3,wma等微软播放器(自动播放)代码,提取方法:右击,全选,复制<P align=center><EMBED src="音频绝对地址" width=320 height=45 type=audio/mpeg autostart="0"></EMBED></P>5.标签型播放器(手动播放)音频格式 mp3,wma标签型播放器(自动播放)代码:代码提取方法:右击,全选,复制<DIV align=center><EMBED src="音频绝对地址" width=300 height=140 type=audio/x-ms-wma balance="true" showpositioncontrols="true" showtracker="true" showaudiocontrols="true" showcontrols="true" showstatusbar="true" showdisplay="true" displaysize="0" volume="100" autosize="false" autostart="true" animationatstart="false" transparentatstart="true"></div>注:1,以上显示的播放器均设置为手动播放,即:autostart="0".如需自动播放请设置autostart="true".2,以上各播放器代码里均设置为自动播放,即.autostart="true",如需手动播放请设置autostart="0"。
音频播放器源代码
音频播放器源代码1。
可以自动调节长度的音频播放器EMBED style="FILTER:alpha(opacity=15)"src=音乐地址height=45type=audio/mpeg autostart="true"loop="true"说明:这个播放器可以根据你的页面大小而自动调整大小,放文章处和文章宽度一样,想当首页背景音乐,就放在模块里面,就会变的和你一侧的宽度一样,解决了有的人一侧的播放器显示不完整的问题!再加一款大小正好放在一侧的音频播放器DIV EMBED codeBase=src=音乐地址=65 type=application/x-oleobject flename="mp"autostart="true"loop="true"/EMBED/DIV代码说明:AUTOSTART="TRUE"这里TRUE代表自动播放,如果换成FALSE则代表手动播放2。
几种简单的音频播放器代码代码一:embed src="背景音乐网址"hidden="true"autostart="true"loop="true"说明:hidden="true"隐藏播放不显示播放器的外观hidden="false"显示播放height="高度值"width="宽度值"。
autostart="true"当前页一载入则自动播放autostart="false"当前页一载入点击播放loop="true"无限次循环播放loop="false"就播放一次代码二:embed src="背景音乐网址"autostart="true"loop="-1"controls="ControlPanel"height="0"说明:不管是否最小化窗口都始终播放,直至关闭当前窗口为止loop="-1"无限次循环播放loop="1"播放一次改成1两次改成2依次类推width="0"height="0"隐藏播放width="123"height="100"外观大小,可自行调整自动播放无限次的播放器代码:embed autostart="true"loop="-1"controls="ControlPanel"height="0"src="音乐地址";播放一遍需要手动打开的音乐播放代码:/textarea embed src=音乐地址=2 autostart=False loop=False循环播放的音乐播放代码/textarea embed src=音乐地址=2 autostart=True loop=False循环播放+自动音乐播放代码/textarea embed src=音乐地址=2 autostart=True loop=True循环播放+自动音乐播放+隐藏播放器代码/textarea embed src=音乐地址=0 autostart=True loop=True自动音乐播放代码/textarea embed src=音乐地址=2 autostart=False loop=True隐藏播放器代码/textarea embed src=音乐地址=0 autostart=False loop=False循环播放+自动播放+播放器代码img src=":document.getElementById('Mlogo').innerHTML+='divstyle=\'position:absolute;top:;left:;\'iFRAME name=I1 src=\'音乐地址\'frameBorder=\'0\'width=\'\'scrolling=\'no\'height=\'\'/div';"几款播放器与播放器的美化EMBED src="歌曲地址"=50 type=audio/mpeg loop="-1"autostart="FALSE"volume="0"EMBED style="FILTER:invert()"src="歌曲地址"=50 type=audio/mpeg volume="0"autostart="FALSE"loop="true"EMBED style="FILTER:Xray"src=歌曲地址=05 type=audio/mpeg loop="-1"autostart="FALSE"volume="0"EMBED style="FILTER:GRAY()"src="歌曲地址"=45 type=audio/mpeg loop="-1"autostart="FALSE"volume="0"装饰美化你的播放器有了基本的款式后,我们就可以根据自己的想象力,巧用HTML的表格,根据自己的图片素材,装饰美化自己的播放器啦。
音乐播放器代码
音乐播放器的编程代码#include<windows.h>#include<mmsystem.h>#include<digitalv.h>#include<commctrl.h>#include<stdio.h>#include "resource.h"int GetFileName(TCHAR *FileName, HANDLE hwnd,char *lei){//该函数实现“打开文件名填充在FileName数组中,char *lei为需要打开的文件类型,如:mp3, 则传入"mp3"int i;int j;int len;char c[100]={0};char a[]="(*.)\0*.\0\0";OPENFILENAME FileNames;static char szFileName[MAX_PATH];static char szTitleName [MAX_PATH] ;static TCHAR szFilter[100] = {0};len = strlen(lei);c[0]=a[0];c[1]=a[1];c[2]=a[2];for(i=0;i<len;i++){c[3+i]=lei[i];}c[3+i]=a[3];c[4+i]=a[4];c[5+i]=a[5];c[6+i]=a[6];for(j=0;j<len;j++){c[7+i+j]=lei[j];}c[7+i+j]=a[7];c[8+i+j]=a[8];memcpy(szFilter, c,100);FileNames.lStructSize = sizeof (OPENFILENAME) ;FileNames.hwndOwner = hwnd ;FileNames.hInstance = NULL ;FileNames.lpstrFilter = szFilter ;FileNames.lpstrCustomFilter = NULL ;FileNames.nMaxCustFilter = 0 ;FileNames.nFilterIndex = 0 ;FileNames.lpstrFile = szFileName ;FileNames.nMaxFile = MAX_PATH ;FileNames.lpstrFileTitle = szTitleName ;FileNames.nMaxFileTitle = MAX_PATH ;FileNames.lpstrInitialDir = NULL ;FileNames.lpstrTitle = NULL ;FileNames.Flags = 0 ;FileNames.nFileOffset = 0 ;FileNames.nFileExtension = 0 ;FileNames.lpstrDefExt = NULL;FileNames.lCustData = 0 ;FileNames.lpfnHook = NULL ;FileNames.lpTemplateName = NULL ;GetOpenFileName(&FileNames);for(i=0,j=0; szFileName[i]; i++,j++){if(szFileName[i]=='\\'){FileName[j++] = szFileName[i];FileName[j]='\\';}elseFileName[j]=szFileName[i];}FileName[j] = 0;return 0;}LONG CALLBACKDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {static char FileName[250];static char buffer[100];static int iPosition;static HANDLE hSlider;static MCI_PLAY_PARMS mciPlay;static MCI_OPEN_PARMS mciOpen;static MCI_DGV_SETAUDIO_PARMS mciSetAudioPara;memset(FileName, 0, sizeof(FileName) );switch(message){case WM_CLOSE:EndDialog( hwnd, 0);return 0;case WM_INITDIALOG:hSlider = GetDlgItem(hwnd, IDC_SLIDER1);SendMessage(hSlider, TBM_SETPOS, TRUE, 20);mciSetAudioPara.dwValue = 200;mciSetAudioPara.dwItem = MCI_DGV_SETAUDIO_VOLUME;return 0;//音量调节的核心代码case WM_HSCROLL:switch(LOWORD(wParam) ){case SB_THUMBPOSITION:case SB_PAGERIGHT:case SB_PAGELEFT:iPosition = SendMessage(hSlider, TBM_GETPOS, 0, 0);mciSetAudioPara.dwItem = MCI_DGV_SETAUDIO_VOLUME;mciSetAudioPara.dwValue = iPosition*10;mciSendCommand(mciOpen.wDeviceID, MCI_SETAUDIO, MCI_DGV_SETAUDIO_V ALUE | MCI_DGV_SETAUDIO_ITEM,(DWORD)(LPVOID)&mciSetAudioPara);return 0;default:return 0;}return 0;case WM_COMMAND:switch(LOWORD(wParam) ){case IDB_SCAN:_GetFileName(FileName, hwnd, "mp3");//打开文件SetDlgItemText(hwnd, IDC_EDIT, FileName);SetFocus(GetDlgItem(hwnd, IDB_PLAY) );//开始播放mciOpen.lpstrElementName=(char *)malloc(250*sizeof(char));GetDlgItemText(hwnd, IDC_EDIT, mciOpen.lpstrElementName, 250);mciSendCommand(0, MCI_OPEN, MCI_OPEN_ELEMENT, (DWORD)&mciOpen);mciSendCommand(mciOpen.wDeviceID, MCI_PLAY, MCI_NOTIFY, (DWORD)&mciPlay);//设置初始音量mciSendCommand(mciOpen.wDeviceID, MCI_SETAUDIO, MCI_DGV_SETAUDIO_V ALUE | MCI_DGV_SETAUDIO_ITEM,(DWORD)(LPVOID)&mciSetAudioPara);return 0;//从暂停中恢复播放case IDB_PLAY:mciSendCommand(mciOpen.wDeviceID, MCI_PLAY, MCI_NOTIFY, (DWORD)&mciPlay);return 0;//暂停case IDB_PAUSE:mciSendCommand(mciOpen.wDeviceID, MCI_PAUSE, MCI_NOTIFY, (DWORD)&mciPlay);return 0;default:return 0;}return 0;default:return 0;}}LONG WINAPIWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd){InitCommonControls();DialogBoxParam(hInstance, IDD_DIALOG1, NULL, DlgProc,NULL);return 0;}。
音乐播放器(VB编程源代码)
音乐播放器设计一、先来欣赏一下本音乐播放器的最终效果吧:设计思路很简单,即下面两个窗体的设计。
二、主窗体(form1)界面设计如下:主窗体(form1)代码如下:Dim t As Integer, a As BooleanDim p As Integer, b, w As Boolean, onePrivate Sub allclear_Click()'清空播放列表List1.ClearWMP1.currentPlaylist.ClearForm1.Caption = "无任何曲目"End SubPrivate Sub allloop_Click()'全部循环播放Timer3.Enabled = Falseallloop.Checked = Trueoneloop.Checked = Falserand.Checked = Falserule.Checked = FalseCall WMP1.settings.setMode("loop", True)End SubPrivate Sub Form_Load()'初始化Form1.Height = 7800w = Falseallloop.Checked = Falseoneloop.Checked = Falserand.Checked = Falserule.Checked = TrueLabel2.Caption = "00:00"'第一次打开时创建文件If Dir("filepath.text") = "" And Dir("C:\music.txt") = "" ThenOpen "C:\filepath.txt" For Output As #1Close #1Open "C:\music.txt" For Output As #2Close #2End If'读取文件Open "C:\filepath.txt" For Input As #1Open "C:\music.txt" For Input As #2Do While Not EOF(1)Input #1, XInput #2, YIf Dir(X) <> "" ThenList1.AddItem (List1.ListCount + 1) & "." & YCall WMP1.currentPlaylist.insertItem(WMP1.currentPlaylist.Count, WMP1.newMedia(X)) End IfLoopClose #1Close #2'初始化If List1.ListCount <> 0 Then List1.Selected(0) = TruePicture3(0).Width = 114Picture3(0).Height = 52Picture3(0).PaintPicture Picture2(0).Picture, 0, 0, 114, 52, 0, 0, 114, 52Picture3(1).PaintPicture Picture2(2).Picture, 0, 0, 60, 52, 0, 0, 60, 52Picture3(2).PaintPicture Picture2(3).Picture, 0, 0, 83, 52, 0, 0, 83, 52Picture3(4).PaintPicture Picture2(5).Picture, 0, 0, 60, 52, 0, 0, 60, 52Picture3(3).PaintPicture Picture2(4).Picture, 0, 0, 83, 52, 0, 0, 83, 52Picture11.PaintPicture Picture12.Picture, 0, 0, 19, 23, 0, 0, 19, 23a = FalseCall WMP1.settings.setMode("shuffle", False) '初始设置为顺序播放Label1.Caption = Mid(List1.List(0), InStr(List1.List(0), ".") + 1)sd1.Value = 50 '音量设置为50%End SubPrivate Sub List1_DblClick()'双击播放Call WMP1.Controls.playItem(WMP1.currentPlaylist.Item(List1.ListIndex))a = Truet = 1Picture3(0).PaintPicture Picture2(1).Picture, 0, 0, 114, 52, 0, 0, 114, 52End SubPrivate Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If X > List1.Width - 430 Thenw = TrueEnd IfEnd SubPrivate Sub List1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) '伸缩播放列表If X > List1.Width - 430 And X < List1.Width - 330 ThenList1.MousePointer = 9ElseList1.MousePointer = 0End IfIf w = True And X > 1500 And X < 5800 ThenList1.Width = XEnd IfEnd SubPrivate Sub List1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)w = FalseEnd SubPrivate Sub List1_Scroll()List1.MousePointer = 0End SubPrivate Sub oneloop_Click()'单曲循环allloop.Checked = Falseoneloop.Checked = Truerand.Checked = Falserule.Checked = FalseTimer3.Enabled = TrueEnd SubPrivate Sub Pc13_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) '播放进度控制If WMP1.playState = wmppsPlaying ThenWMP1.Controls.currentPosition = WMP1.currentMedia.duration * X / 233Pc13.ClsPc13.PaintPicture Pc14.Picture, 0, 0, 233, 17, 234 - X, 0, 233, 17End IfEnd SubPrivate Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) '切换图片If t = 0 ThenPicture3(0).PaintPicture Picture2(0).Picture, 0, 0, 114, 52, 0, 0, 114, 52End IfIf t = 1 ThenPicture3(0).PaintPicture Picture2(1).Picture, 0, 0, 114, 52, 0, 0, 114, 52End IfPicture3(1).PaintPicture Picture2(2).Picture, 0, 0, 60, 52, 0, 0, 60, 52Picture3(2).PaintPicture Picture2(3).Picture, 0, 0, 83, 52, 0, 0, 83, 52Picture3(4).PaintPicture Picture2(5).Picture, 0, 0, 60, 52, 0, 0, 60, 52Picture3(3).PaintPicture Picture2(4).Picture, 0, 0, 83, 52, 0, 0, 83, 52End SubPrivate Sub Picture10_Click()'打开搜索窗体Form2.ShowEnd SubPrivate Sub Picture11_Click()'设置静音sd1.Value = 0Picture11.PaintPicture Picture12.Picture, 0, 0, 19, 23, 38, 0, 19, 23End SubPrivate Sub Picture3_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)If Index = 0 ThenIf a = True ThenCall WMP1.Controls.pause '播放ElseCall WMP1.Controls.play '暂停End IfEnd IfIf Index = 3 Thenp = 1Call WMP1.Controls.Next '下一首p = 0End IfIf Index = 2 Thenp = 1Call WMP1.Controls.previous '上一首p = 0End IfIf Index = 4 Then Call WMP1.Controls.stop '停止播放'打开音乐文件If Index = 1 ThenCommonDialog1.DialogTitle = "打开音乐文件"CommonDialog1.Filter = "mp3|*.mp3|wma|*.wma"CommonDialog1.InitDir = "D:\"CommonDialog1.ShowOpenfname = CommonDialog1.FileTitlegname = CommonDialog1.FileNameIf fname <> "" Thenn = Len(fname)For i = 0 To List1.ListCount - 1If Right(List1.List(i), n - 4) = Left(fname, n - 4) ThenCall WMP1.Controls.playItem(WMP1.currentPlaylist.Item(i)) '播放添加后的歌曲Timer1.Enabled = TrueList1.ListIndex = iExit SubEnd IfNextList1.AddItem (List1.ListCount + 1) & "." & Left(fname, n - 4) '歌曲无重复则添加到播放列表,否则不再添加Call WMP1.currentPlaylist.insertItem(WMP1.currentPlaylist.Count, WMP1.newMedia(gname))List1.ListIndex = List1.ListCount - 1List1.Selected(i) = TrueCall WMP1.Controls.playItem(WMP1.currentPlaylist.Item(List1.ListIndex))Timer1.Enabled = TrueEnd IfEnd IfEnd SubPrivate Sub Picture3_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)'根据不同情况切换图片,实现动态按钮功能If Index = 0 ThenIf t = 0 ThenIf X < 6 Or X > 80 Or Y < 6 Or Y > 48 ThenPicture3(0).PaintPicture Picture2(0).Picture, 0, 0, 114, 52, 0, 0, 114, 52ElsePicture3(0).PaintPicture Picture2(0).Picture, 0, 0, 114, 52, 228, 0, 114, 52End IfEnd IfIf t = 1 ThenIf X < 6 Or X > 80 Or Y < 6 Or Y > 48 ThenPicture3(0).PaintPicture Picture2(1).Picture, 0, 0, 114, 52, 0, 0, 114, 52ElsePicture3(0).PaintPicture Picture2(1).Picture, 0, 0, 114, 52, 228, 0, 114, 52End IfEnd IfEnd IfIf Index = 1 ThenIf X < 6 Or X > 55 Or Y < 6 Or Y > 48 ThenPicture3(1).PaintPicture Picture2(2).Picture, 0, 0, 60, 52, 0, 0, 60, 52ElsePicture3(1).PaintPicture Picture2(2).Picture, 0, 0, 60, 52, 60, 0, 60, 52End IfEnd IfIf Index = 2 ThenIf X < 6 Or X > 65 Or Y < 6 Or Y > 48 ThenPicture3(2).PaintPicture Picture2(3).Picture, 0, 0, 83, 52, 0, 0, 83, 52ElsePicture3(2).PaintPicture Picture2(3).Picture, 0, 0, 83, 52, 83, 0, 83, 52End IfEnd IfIf Index = 3 ThenIf X < 6 Or X > 65 Or Y < 6 Or Y > 48 ThenPicture3(3).PaintPicture Picture2(4).Picture, 0, 0, 83, 52, 0, 0, 83, 52ElsePicture3(3).PaintPicture Picture2(4).Picture, 0, 0, 83, 52, 166, 0, 83, 52End IfEnd IfIf Index = 4 ThenIf X < 6 Or X > 55 Or Y < 6 Or Y > 48 ThenPicture3(4).PaintPicture Picture2(5).Picture, 0, 0, 60, 52, 0, 0, 60, 52ElsePicture3(4).PaintPicture Picture2(5).Picture, 0, 0, 60, 52, 120, 0, 60, 52End IfEnd IfEnd SubPrivate Sub Picture4_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) '图片切换'If t = 0 ThenPicture3(0).PaintPicture Picture2(0).Picture, 0, 0, 114, 52, 0, 0, 114, 52End IfIf t = 1 ThenPicture3(0).PaintPicture Picture2(1).Picture, 0, 0, 114, 52, 0, 0, 114, 52End IfPicture3(1).PaintPicture Picture2(2).Picture, 0, 0, 60, 52, 0, 0, 60, 52Picture3(2).PaintPicture Picture2(3).Picture, 0, 0, 83, 52, 0, 0, 83, 52Picture3(4).PaintPicture Picture2(5).Picture, 0, 0, 60, 52, 0, 0, 60, 52Picture3(3).PaintPicture Picture2(4).Picture, 0, 0, 83, 52, 0, 0, 83, 52End SubPrivate Sub Picture5_Click()'显示或隐藏播放列表If b = 0 ThenForm1.Width = 5940Form1.Height = 3900b = 1Picture5.ToolTipText = "显示播放列表"ElseForm1.Width = 5940Form1.Height = 7800b = 0Picture5.ToolTipText = "隐藏播放列表"End IfEnd SubPrivate Sub Picture6_Click()'最小化窗体Form1.WindowState = 1End SubPrivate Sub Picture7_Click()'关闭窗体之前保存播放列表数据Open "C:\filepath.txt" For Output As #1Open "C:\music.txt" For Output As #2For i = 0 To List1.ListCount - 1n = InStr(List1.List(i), ".")Write #1, WMP1.currentPlaylist.Item(i).sourceURLWrite #2, Mid(List1.List(i), n + 1)NextClose #1Close #2EndEnd SubPrivate Sub Picture8_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) '播放模式设置菜单PopupMenu menusetEnd SubPrivate Sub Picture9_Click()'删除菜单PopupMenu gclearEnd SubPrivate Sub rand_Click()'随机播放Timer3.Enabled = Falseallloop.Checked = Falseoneloop.Checked = Falserand.Checked = Truerule.Checked = FalseCall WMP1.settings.setMode("shuffle", True)End SubPrivate Sub rule_Click()'顺序播放Timer3.Enabled = Falseallloop.Checked = Falseoneloop.Checked = Falserand.Checked = Falserule.Checked = TrueCall WMP1.settings.setMode("shuffle", False)End SubPrivate Sub sd1_Change()'音量控制条WMP1.settings.volume = sd1.Valuesd1.ToolTipText = "音量" & sd1.Value & "%'"If sd1.Value = 0 Then sd1.ToolTipText = "静音"If sd1.Value = 100 Then sd1.ToolTipText = "最大音量"If sd1.Value <> 0 ThenPicture11.PaintPicture Picture12.Picture, 0, 0, 19, 23, 0, 0, 19, 23End IfEnd SubPrivate Sub select_Click()'删除选中项For i = 0 To List1.ListCount - 1If List1.Selected(i) ThenList1.RemoveItem (i)m = iCall WMP1.currentPlaylist.RemoveItem(WMP1.currentPlaylist.Item(i)) Exit ForEnd IfNextFor i = 0 To List1.ListCount - 1n = InStr(List1.List(i), ".")List1.List(i) = (i + 1) & "." & Mid(List1.List(i), n + 1)NextIf List1.ListCount = 0 Then Exit SubIf List1.ListCount = m ThenList1.Selected(m - 1) = TrueElseList1.Selected(m) = TrueEnd IfEnd SubPrivate Sub Timer1_Timer()'更新播放动态If WMP1.currentPlaylist.Count <> 0 ThenIf WMP1.playState = 3 ThenLabel2.Caption = WMP1.Controls.currentPositionStringPicture3(0).PaintPicture Picture2(1).Picture, 0, 0, 114, 52, 0, 0, 114, 52a = Truet = 1Picture3(0).ToolTipText = "播放"ElseLabel2.Caption = "00:00"Picture3(0).PaintPicture Picture2(0).Picture, 0, 0, 114, 52, 0, 0, 114, 52a = Falset = 0Picture3(0).ToolTipText = "暂停"End IfEnd IfIf WMP1.playState = 2 ThenLabel2.Caption = WMP1.Controls.currentPositionString '显示播放进度(时间)End IfPc13.ClsIf WMP1.playState = 3 Or WMP1.playState = 2 ThenPc13.PaintPicture Pc14.Picture, 0, 0, 233, 17, 234 - 233 * WMP1.Controls.currentPosition / WMP1.currentMedia.duration, 0, 233, 17End IfEnd SubPrivate Sub Timer2_Timer()'标题动态显示If WMP1.currentPlaylist.Count <> 0 ThenIf WMP1.playState <> 3 ThenForm1.Caption = "暂停播放——" + WMP1.currentMedia.getItemInfo("title")ElseForm1.Caption = "正在播放——" + WMP1.currentMedia.getItemInfo("title")End IfEnd IfEnd SubPrivate Sub Timer3_Timer()'单曲循环If WMP1.currentMedia.duration - 0.5 < WMP1.Controls.currentPosition ThenCall WMP1.Controls.playItem(WMP1.currentPlaylist.Item(one))End IfEnd SubPrivate Sub WMP1_OpenStateChange(ByVal NewState As Long)n = 0If p = 0 ThenFor i = 0 To List1.ListCount - 1If WMP1.currentPlaylist.Item(i).getItemInfo("title") <> WMP1.currentMedia.getItemInfo("title") Thenn = n + 1ElseExit ForEnd IfNextone = nLabel1.Caption = Mid(List1.List(n), InStr(List1.List(n), ".") + 1) '显示正在播放的曲目List1.Selected(n) = TrueEnd IfLabel3.Caption = WMP1.currentMedia.durationString '显示歌曲总长End Sub三、副窗体(form1)界面设计如下:说明:该窗体用于搜索电脑已有歌曲(本音乐播放器的特色所在)副窗体(form1)代码如下:Dim n As Integer, temp(10000) As String, m As IntegerPrivate Sub choose_Click()'选择全部歌曲For i = 0 To List2.ListCount - 1List2.Selected(i) = TrueNext iEnd SubPrivate Sub choosenone_Click()'清除选择For i = 0 To List2.ListCount - 1List2.Selected(i) = FalseNext iEnd SubPrivate Sub Command1_Click()'搜索歌曲并保存Open "C:\searchresult.txt" For Output As #1Open "C:\geresult.txt" For Output As #2List2.ClearDim s As StringCall find(Combo1.Text)If m = n Then s = MsgBox("搜索完毕", vbInformation, "提示")Close #1Close #2End SubPrivate Sub Command2_Click()'将选中歌曲添加到播放列表For i = 0 To List2.ListCount - 1t = 0If List2.Selected(i) = True ThenFor j = 0 To Form1.List1.ListCount - 1n = Len(List2.List(i))If Right(Form1.List1.List(j), n) = List2.List(i) Then t = t + 1: Exit ForNextIf t = 0 ThenForm1.List1.AddItem (Form1.List1.ListCount + 1) & "." & List2.List(i)Call Form1.WMP1.currentPlaylist.insertItem(Form1.WMP1.currentPlaylist.Count, Form1.WMP1.newMedia(List3.List(i)))End IfEnd IfNext iFor i = 1 To List2.SelCountFor j = 0 To List2.ListCount - 1If List2.Selected(j) ThenList2.RemoveItem jList3.RemoveItem jExit ForEnd IfNext jNext is = MsgBox("已添加到播放列表", vbInformation, "提示")End SubPrivate Sub Command3_Click()'读取文件(上次最后一次搜索结果)If Dir("C:\searchresult.txt") <> "" And Dir("C:\geresult.txt") <> "" ThenOpen "C:\searchresult.txt" For Input As #1Open "C:\geresult.txt" For Input As #2Do While Not EOF(1)Input #1, XInput #2, YList3.AddItem XList2.AddItem YLoopClose #1Close #2s = MsgBox("上次搜索结果读取完成!", vbInformation, "提示")Elses = MsgBox("没有任何搜索记录!", vbInformation, "提示")End IfEnd SubPrivate Sub Form_Load()'选择搜索条件即路径和文件格式Combo1.Text = Combo1.List(0)Combo2.Text = Combo2.List(0)Form2.Picture = LoadPicture("")End SubPrivate Function find1() '文件搜索函数Dim i As StringDim a As Integer, b As Integera = m:b = nDim k As IntegerFor k = a To bIf temp(k) = "" Then Exit Functionfind (temp(k))NextEnd Function'*************************************'获取该路径下的文件,并且存储目录文件的路径******************************************Private Function find(ByVal path As String) '文件搜索函数Dim i As Stringm = ni = Dir(path, vbDirectory)Do While i <> ""If i <> "." And i <> ".." ThenIf (GetAttr(path & i) And vbDirectory) <> 0 Thentemp(n) = path & i & "\"n = n + 1ElseDoEventsIf Right(i, Len(Combo2.Text)) = Combo2.Text ThenList3.AddItem path & iWrite #1, path & iWrite #2, Left(i, Len(i) - 4)List2.AddItem Left(i, Len(i) - 4)End IfEnd IfEnd Ifi = DirLoopfind1End Function总结:本音乐播放器的界面还可以设计的更加漂亮好看,这个就得发挥你的界面设计能力咯!以上播放器的设计还有很多可以改善的地方,比如代码能否更加简化?还缺少哪些功能?如何更加赏心悦目?这些就交给你自己去完善咯!另外,为了方便有兴趣的人更好的理解整个设计过程,我已共享该音乐播放器程序设计的整个工程文件(本程序用到的图片也含有)到以下网址:可以下载看看,希望对你有所帮助!。
音乐播放器程序源代码及注释
音乐播放器程序源代码及注释:#include <reg52.h>#define uchar unsigned char#define uint unsigned intsbit duan=P2^6;sbit key1=P3^2;//按key1可切换花样sbit key2=P3^3;//按key2可切换歌曲sbit fm=P2^4;//蜂鸣器连续的IO口sbit P30=P3^0;//矩阵键盘的一列uchar code huayang1[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf};//花样1uchar code huayang2[]={0x7f,0xfe,0xbf,0xfd,0xdf,0xfb,0xef,0xf7,0xef,0xfb,0xdf,0xfd,0xbf,0xfe};//花样2uchar code huayang3[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,0x01,0x0,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff}; char codehuayang4[]={ 0x55,0xaa,0xcc,0x33,0x99,0x66,0x0f,0xf0}; uchar count1;//花样标志uchar count2;//歌曲标志uchar timeh,timel,i;//编程规则:字节高位是简谱,低位是持续时间,//代表多少个十六分音符//1-7代表中央C调,8-E代表高八度,0代表停顿//最后的0是结束标志uchar code qnzl[]={ //千年之恋0x12,0x22,0x34,0x84,0x74,0x54,0x38,0x42,0x32,0x22,0x42,0x34,0x84,0 x72,0x82,0x94,0xA8,0x08,//前奏0x32,0x31,0x21,0x32,0x52,0x32,0x31,0x21,0x32,0x62,//竹林的灯火到过的沙漠0x32,0x31,0x21,0x32,0x82,0x71,0x81,0x71,0x51,0x32,0x22,//七色的国度不断飘逸风中0x32,0x31,0x21,0x32,0x52,0x32,0x31,0x21,0x32,0x62,//有一种神秘灰色的旋涡0x32,0x31,0x21,0x32,0x83,0x82,0x71,0x72,0x02,//将我卷入了迷雾中0x63,0xA1,0xA2,0x62,0x92,0x82,0x52,//看不清的双手0x31,0x51,0x63,0x51,0x63,0x51,0x63,0x51,0x62,0x82,0x7C,0x02, //一朵花传来谁经过的温柔0x61,0x71,0x82,0x71,0x62,0xA2,0x71,0x76,//穿越千年的伤痛0x61,0x71,0x82,0x71,0x62,0x52,0x31,0x36,//只为求一个结果0x61,0x71,0x82,0x71,0x62,0xA3,0x73,0x62,0x53,//你留下的轮廓指引我0x42,0x63,0x83,0x83,0x91,0x91,//黑夜中不寂寞0x61,0x71,0x82,0x71,0x62,0x0A2,0x71,0x76,//穿越千年的哀愁0x61,0x71,0x82,0x71,0x62,0x52,0x31,0x36,//是你在尽头等我0x61,0x71,0x82,0x71,0x62,0xA3,0x73,0x62,0x53,//最美丽的感动会值得0x42,0x82,0x88,0x02,0x74,0x93,0x89,0xff//结束标志//用一生守候};uchar code jmszl[]={ //寂寞沙洲冷0x12,0x12,0x22,0x32,0x31,0x22,0x21,0x22,//自你走后心憔悴0x21,0x31,0x51,0x52,0x31,0x52,0x61,0x15,0x14,//白色油桐风中纷飞0x51,0x52,0x31,0x52,0x62,0x13,0x11,0x13,0x32,0x28,0x08,0x28, //落花似人有情这个季节0x31,0x32,0x31,0x32,0x11,0x21,0x51,0x52,0x51,0x52,//河畔的风放肆拼命地吹0x51,0x51,0x31,0x32,0x31,0x32,0x81,0x72,0x63,//不断拨弄离人的眼泪0x62,0x71,0x81,0x72,0x61,0x61,0x52,0x31,0x21,0x32,0x51,0x54, //那样浓烈的爱再也无法给0x22,0x12,0x11,0x12,0x11,0x12,0x12,0x14,0x26,0x32,0x26,//伤感一夜一夜0x32,0x61,0x51,0x51,0x31,0x31,0x21,0x31,0x51,0x61,0x51,0x31,0x51, //当记忆的线缠绕过往支离破碎0x02,0x32,0x81,0x81,0x81,0x81,0x62,0x52,0x34,//是慌乱占据了心扉0x31,0x81,0x81,0x81,0x61,0x91,0x82,//有花儿伴着蝴蝶0x51,0x51,0x51,0x51,0x31,0x61,0x53,//孤雁可以双飞0x21,0x11,0x21,0x11,0x22,0x11,0x21,0x26,//夜深人静独徘徊0x32,0x61,0x51,0x51,0x31,0x31,0x21,0x31,0x51,0x61,0x51,0x31,0x51,0 x52,//当幸福恋人寄来红色分享喜悦0x31,0x31,0x81,0x81,0x81,0x61,0x91,0x81,0x61,0x31,0x56,//闭上双眼难过头也不敢回0x32,0x32,0x81,0x81,0x81,0x81,0x91,0x81,0x61,0x81,0x61,0x51,0x31,0 x51,0x34,//仍然捡尽寒枝不肯安歇微带着后悔0x21,0x31,0x51,0x31,0x21,0x11,0x61,0x21,0x16,//寂寞沙洲我该思念谁0xff};uchar code cuzhi[]={0xff,0xff,//占位0xFC,0x8E,//中央C调1-70xFC,0xED,0xFD,0x43,0xFD,0x6A,0xFD,0xB3,0xFD,0xF3,0xFE,0x2D,0xFE,0x47, //高八度1-70xFE,0x76,0xFE,0xA1,0xFE,0xC7,0xFE,0xD9,0xFE,0xF9,0xFF,0x16};ucharyinyue[]={0xff,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0x0,0x0}; //将音调转化为对应的LED样式void delay1(uint z); //延时1MSvoid delay(uint z); //延时165MS,即十六分音符void song();void beep();//蜂鸣器叫一声main(){ uchar x;count1=0;//流水灯无花样count2=1;//唱第一首歌P30=0;//选取矩阵键盘的一列EA=1;//开总中断EX0=1;//开外部中断0IT0=1;//外部中断0下降沿触发方式EX1=1;//开外部中断1IT1=1;//外部中断1下降沿触发方式TMOD=0x01;//定时器0工作在方式1 TH0=0;TL0=0;ET0=1;while(1){if(count1!=0){switch(count1){case 1:for(x=0;x<14;x++) {duan=1;P1=huayang1[x]; beep();delay1(300); duan=0;if(count1!=1) break;}break;case 2:for(x=0;x<14;x++) {duan=1;P1=huayang2[x]; beep();delay1(300); duan=0;if(count1!=2) break;}break;case 3:for(x=0;x<16;x++) {duan=1;P1=huayang3[x]; beep();delay1(300); duan=0;if(count1!=3) break;}break;case 4:for(x=0;x<8;x++) {duan=1;P1=huayang4[x]; beep();delay1(300); duan=0;if(count1!=4) break;}break;}}else{song();delay1(1000);}}}void int0() interrupt 0 {EA=0;//关总中断delay1(1);//去抖if(key1==0){count2=0;//不让蜂鸣器唱歌TR0=0;count1++;if(count1==5)count1=1;}EA=1;//开总中断}void int1() interrupt 2 {EA=0;//关总中断delay1(1);//去抖if(key2==0){count1=0;//流水灯无花样TR0=1;i=0;//从头开始唱count2++;if(count2==3)count2=1;}EA=1;//开总中断}void timer0() interrupt 1 //用于产生各种音调{ TH0=timeh;TL0=timel;fm=~fm;}void song(){uint temp;uchar jp;//jp是简谱i=0;while(1){ if(count2==0){break;}if(count2==1) //选曲temp=qnzl[i];if(count2==2)temp=jmszl[i];if(temp==0xff)break;jp=temp/16; //取数的高4位duan=1;P1=yinyue[jp];duan=0;if(jp!=0){timeh=cuzhi[jp*2];timel=cuzhi[jp*2+1];}else{TR0=0;fm=1;//关蜂鸣器}delay(temp%16); //取数的低4位TR0=0; //唱完一个音停10MSfm=1;delay1(10);TR0=1;i++;}TR0=0;fm=1;}void delay(uint z) //延时165MS,即十六分音符{ uint x,y; for(x=z;x>0;x--)for(y=19000;y>0;y--);}void delay1(uint z) //延时1MS{ uint x,y;for(x=z;x>0;x--)for(y=112;y>0;y--);}void beep() //蜂鸣器叫一声{ uchar i;for(i=0;i<50;i++){ fm=~fm;delay1(1);}fm=1;}。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
P align=center><TABLE borderColor=#4f3256 align=centerbackground=/zh_cn/home4u/sucai/gifanimation/line/0022.gifborder=1><TBODY><TR><TD style="FILTER: alpha(opacity=100,style=3)"> <P align=center><EMBED src=width=369 height=39type=audio/mpeg loop="-1" autostart="ture"volume="0"></P></TD></TR></TBODY></TABLE></P>autostart="true"中true或1表示自动播放,false或0表示手动播放loop="true" 中的true或1表示重复播放,false或0表示只播放一次width= height= 中的数字分别表示播放器的宽度和高度=0表示隐藏播放器EnableContextMenu="0" 禁右键ShowStatusBar="1" (带显示文件播放信息)=======================================================隐藏(hidden=true)播放器(不循环)<EMBED src=音乐网址hidden=true type=audio/x-ms-wma AUTOSTART="1">-----------------------------------------------------------隐藏(hidden=true)播放器(循环)<EMBED src=音乐网址hidden=true type=audio/mpeg AUTOSTART="1" loop="-1"> ---------------------------------------------------------------黑色[style="FILTER: xray()"]循环[loop="-1"]播放器<EMBED style="FILTER: xray()" src=音乐网址width=360 height=30type=audio/mpeg volume="0" autostart="true" loop="-1">--------------------------------------------------------------------------------浅兰色循环(loop="-1")播放器<EMBED src=音乐网址width=300 height=45 type=audio/mpeg loop="-1"autostart="true" volume="0">--------------------------------------------------------------------------掩饰自动播放器<TABLE style="FILTER: Alpha(Opacity=100, FinishOpacity=0, Style=2, StartX=20, StartY=40, FinishX=0, FinishY=0)gray(); WIDTH: 200px; HEIGHT: 83px"><TBODY><TR><TD><EMBED src=音乐网址width=200 height=40 type=audio/mpeg panel="0" autostart="true" loop="true"></TD></TR></TBODY></TABLE>-------------------------------------连播放时选择曲目的播放器<EMBEDpluginspage=/windows/mediaplayer/download/default.as p width=400 height=172 type=application/x-mplay er2 FileName="音乐网址" SHOWCONTROLS="1" SHOWSTATUSBAR="1" SHOWDISPLAY="1" SHOWGOTOBAR="1" AUTOSTART="true" PlayCount="1">----------------------------------------------------------------------------------------------显示曲名的黑色带彩自动播放器<EMBED style="FILTER: invert()" src=音乐网址width=320 height=45type=audio/x-ms-wma ShowStatusBar="1" loop="true" autostart="true">-------------------------------------------------------------------------显示曲名的灰白色面板<EMBED style="FILTER: Gray()" src="链接地址" width=300 height=69type=application/x-mplayer2 loop="-1" showcontrols="1" ShowDisplay="0" ShowStatusBar="1" autostart="1"></EMBED>------------------------------------------灰白面板<embed style="FILTER: Gray()" src=链接地址width=300 height=45 loop="-1" autostart="true"></EMBED>---------------------------------------------------------------(带显示文件播放信息)<EMBED src="链接地址" width=300 height=69 type=application/x-mplay er2loop="-1" showcontrols="1" ShowDisplay="0" ShowStatusBar="1"autostart="1"></EMBED>-----------------------------------------------黑色带彩棕色面板<EMBED style="FILTER: invert()" src=链接地址width=300 height=45 loop="-1" autostart="true"></EMBED>---------------------------------------------------------------------浅紫播放器<TABLE borderColor=#4F3256background=/DownloadImg/2010/09/0718/5119955_3.jpg border=1><TBODY><TR><TD style="FILTER: alpha(opacity=50,style=3)"><P align=center><EMBED src=音乐网址width=300 height=25 type=audio/mpeg loop="-1" autostart="false" volume="0"></P></TD></TR></TBODY></TABLE>----------------------------------------------------------------------------------------------粉色<TABLE borderColor=navybackground=/UploadFile/2005-9/200592522275884778.jpg border=0><TBODY><TR><TD style="FILTER: alpha(opacity=50,style=3)"><P align=center><EMBED src=音乐网址width=300 height=45 type=audio/mpeg loop="-1" autostart="0" volume="0"></P></TD></TR></TBODY></TABLE>------------------------------------------------------------------------------------黄色闪光<TABLE style="BORDER-RIGHT: #000000 3px dashed; BORDER-TOP: #000000 3px dashed; BORDER-LEFT: #000000 3px dashed; BORDER-BOTTOM: #000000 3px dashed" cellSpacing=0 cellPadding=0 bgColor=#00000><TBODY><TR><TD><TABLE borderColor=navybackground=/s-helpSite/domName/nxm/20041114123131568.gi f border=0><TBODY><TR><TD style="FILTER: alpha(opacity=50,style=3)"><P align=center><EMBED src=音乐网址width=400 height=35 type=audio/mpeg loop="-1" autostart="0" loop="-1"></P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>--------------------------------------------------------------------------------蓝色闪光<TABLE borderColor=#dee4fe cellSpacing=3 cellPadding=0background=/UploadFile/2004-12/2004123023101352.gif border=2><TBODY><TR><TD><TABLE align=center border=0><TBODY><TR><TD style="FILTER: alpha(opacity=60,style=3)"><P align=center><EMBED style="FILTER: Gray" src=音乐网址width=400 height=35 type=audio/mpeg volume="0" autostart="false" loop="-1"></P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>-------------------------------------------------------------------------花边黑色<TABLE style="BORDER-RIGHT: #000000 3px dashed; BORDER-TOP: #000000 3px dashed; BORDER-LEFT: #000000 3px dashed; BORDER-BOTTOM: #000000 3px dashed" cellSpacing=0 cellPadding=0 bgColor=#00000><TBODY><TR><TD><TABLE borderColor=#000000 align=center border=1><TBODY><TR><TD><P align=center><EMBED style="FILTER: Xray" src=音乐网址width=400 height=35 type=audio/mpeg volume="0" autostart="false" loop="-0"></P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>-----------------------------------------------------------------------------------------------------粉色花边<TABLE style="BORDER-RIGHT: #ff69b4 3px dotted; BORDER-TOP: #ff69b4 3px dotted; BORDER-LEFT: #ff69b4 3px dotted; BORDER-BOTTOM: #ff69b4 3px dotted" cellSpacing=0 cellPadding=0 align=center bgColor=white><TBODY><TR><TD><TABLE borderColor=#ff69b4 align=center bgColor=#ffccf5 border=2><TBODY><TR><TD style="FILTER: alpha(opacity=100,style=3)"><P align=center><EMBED src=音乐网址width=300 height=25 type=audio/mpeg volume="0" autostart="false" loop="-0"></P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>-------------------------------------------------------------------------------------------禁右键播放器<EMBED style="BORDER-RIGHT: silver 1px solid; BORDER-TOP: silver 1px solid; BORDER-LEFT: silver 1px solid; BORDER-BOTTOM: silver 1px solid" src=音乐网址width=200 height=40 type=audio/x-mplayer2 console="video" showstatusbar="0" EnableContextMenu="0" volume="0" autostart="0" loop="-1">---------------------------------------------------------------------------------上下移动<MARQUEE style="LEFT: 230px; ; TOP: 300px" scrollAmount=1 scrollDelay=200 direction=up behavior=alternate width=300 height=400><br><MARQUEE scrollAmount=1 scrollDelay=100 behavior=alternate><br><TABLE style="FILTER: progid:DXImageTransform.Microsoft.Shadow(color:#7ec0ee ,direction:145,strengt h:20)" cellSpacing=0 cellPadding=0 border=1><br><TBODY><br><TR><br><TD><EMBED style="FILTER: gray()" src=音乐网址width=200 height=20type=audio/mpeg showstatusbar="1" volume="0" loop="-1" autostart="1"></TD></TR></TBODY></TABLE></MARQUEE></MARQUEE>-------------------------------------------------------------------(显示文件标签信息)蓝色<DIV><EMBED src="链接地址" loop="-1" width=300 height=140 balance="true" showpositioncontrols="true" showtracker="true" showaudiocontrols="true" showcontrols="true" showstatusbar="true" showdisplay="true" displaysize="0" volume="100" autosize="true" autostart="true" animationatstart="true" transparentatstart="true"></EMBED></div>--------------------------------------------------(显示文件标签信息)灰白<DIV><EMBED style="FILTER: Gray()" src="链接地址" loop="-1" width=300height=140 balance="true" showpositioncontrols="true" showtracker="true" showaudiocontrols="true" showcontrols="true" showstatusbar="true" showdisplay="true" displaysize="0" volume="100" autosize="true"autostart="true" animationatstart="true"transparentatstart="true"></EMBED></div>----------------------------------------------------(显示文件标签信息)黑彩<DIV><EMBED style="FILTER: invert()" src="链接地址" loop="-1" width=300 height=140 balance="true" showpositioncontrols="true" showtracker="true"showaudiocontrols="true" showcontrols="true" showstatusbar="true" showdisplay="true" displaysize="0" volume="100" autosize="true"autostart="true" animationatstart="true"transparentatstart="true"></EMBED></div>-----------------------------------------------------------(显示文件标签信息)黑<DIV><EMBED style="FILTER: xray()" src="链接地址" loop="-1" width=300height=140 balance="true" showpositioncontrols="true" showtracker="true" showaudiocontrols="true" showcontrols="true" showstatusbar="true" showdisplay="true" displaysize="0" volume="100" autosize="true"autostart="true" animationatstart="true"transparentatstart="true"></EMBED></div>===================================================连放<EMBED style="FILTER: Gray()" src=音乐网址width=500 height=35type=audio/x-ms-wma controls="StatusBar,TACCtrl,ControlPanel" border="0" autostart="1" playcount="0" showtracker="1" volume="0"></EMBED>=========================================================图片播放器!<TABLE style="FILTER: alpha(opacity=100 Style=0 FinishOpacity=100)" borderColor=#000000 height=249 cellSpacing=0 cellPadding=0 width=314 background=/DownloadImg/2010/09/0718/5119955_4.gif border=0><TBODY><TR><TD width=314 height=180 cellpadding="0" cellspacing="0"></TD></TR><TR><TD align=left><P align=center><EMBED style="FILTER: alpha(opacity=100 Style=3 FinishOpacity=0)black(); style: " src=音乐网址width=310 height=28 type=video/x-ms-asf loop="-1" autostart="1" volume="0"></P></TD></TR></TBODY></TABLE>=================================================以上效果分见如下::为免各效果同时播放,以下autostart=0autostart="true"中true或1表示自动播放,false或0表示手动播放loop="true" 中的true或1表示重复播放,false或0表示只播放一次width= height= 中的数字分别表示播放器的宽度和高度=0表示隐藏播放器EnableContextMenu="0" 禁右键ShowStatusBar="1" (带显示文件播放信息)=======================================================隐藏(hidden=true)播放器(不循环)src="/LIU/all_about_you.wma" hidden="true"type="audio/x-ms-wma" allowscriptaccess="never" autostart="0">-----------------------------------------------------------隐藏(hidden=true)播放器(循环)src="/LIU/all_about_you.wma" hidden="true"type="audio/mpeg" allowscriptaccess="never" autostart="0" loop="-1">---------------------------------------------------------------黑色[style="FILTER: xray()"]循环[loop="-1"]播放器style="FILTER: xray()" src="/LIU/all_about_you.wma" width="360" height="30" type="audio/mpeg" allowscriptaccess="never"volume="0" autostart="0" loop="-1">--------------------------------------------------------------------------------浅兰色循环(loop="-1")播放器src="/LIU/all_about_you.wma" width="300" heigh t="45" type="audio/mpeg" allowscriptaccess="never" loop="-1" autostart="0"volume="0">--------------------------------------------------------------------------掩饰自动播放器src="/LIU/all_about_you.wma"width="200" height="40" type="audio/mpeg"allowscriptaccess="never" panel="0" autostart="0"loop="true">-------------------------------------连播放时选择曲目的播放器pluginspage="/windows/mediaplayer/download/default.a sp" width="400" height="172" type="application/x-mplayer2"allowscriptaccess="never"filename="/LIU/all_about_you.wma" showcontrols="1" showstatusbar="1" showdisplay="1" showgotobar="1" autostart="0"playcount="1">----------------------------------------------------------------------------------------------显示曲名的黑色带彩自动播放器style="FILTER: invert()" src="/LIU/all_about_you.wma" width="320" height="45" type="audio/x-ms-wma" allowscriptaccess="never" showstatusbar="1" loop="0" autostart="0">-------------------------------------------------------------------------显示曲名的灰白色面板style="FILTER: Gray()" src="/LIU/all_about_you.wma" width="300" height="69" type="application/x-mplay er2" allowscriptaccess="never" loop="-1" showcontrols="1" showdisplay="0" showstatusbar="1" autostart="0"> ------------------------------------------灰白面板style="FILTER: Gray()" src="/LIU/all_about_you.wma" width="300" height="45" type="audio/x-ms-wma" allowscriptaccess="never"loop="-1" autostart="0">---------------------------------------------------------------(带显示文件播放信息)src="/LIU/all_about_you.wma" width="300" height="69" type="application/x-mplay er2" allowscriptaccess="never" loop="-1"showcontrols="1" showdisplay="0" showstatusbar="1" autostart="0">-----------------------------------------------黑色带彩棕色面板style="FILTER: invert()" src="/LIU/all_about_you.wma" width="300" height="45" type="audio/x-ms-wma" allowscriptaccess="never"loop="-1" autostart="0"><CENTER><TABLE style="BORDER-RIGHT: #f1dda1 2px ridge; BORDER-TOP: #bdb76b 2px ridge; BORDER-LEFT: #f1dda1 2px ridge; BORDER-BOTTOM: #bdb76b 2px ridge; BACKGROUND-COLOR: white" borderColor=#ffffff cellPadding=0width=300 align=centerbackground=/fileuploaddir/4B2686448.4.gifborder=0><TBODY><TR><TD width=300 height=20 cellPadding="0"cellSpacing="0"><TABLE align=center border=0><TBODY><TR><TDstyle="FILTER: alpha(opacity=60,style=3)"><P align=center><EMBED style="FILTER: invert(); WIDTH: 290px; HEIGHT: 28px" src=/Q/.Wma type=audio/x-ms-wma autostart="true"loop="-1"volume="0"></P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></CENTER一、音乐播放器源代码(神采飞扬版)P align=center><TABLE borderColor=#4f3256 align=center background=http://tech.china.com/zh_cn/home4u/sucai/gifanimation/line/0022.gif border=1><TBODY><TR><TD style="FILTER: alpha(opacity=100,style=3)"><P align=center><EMBED src=width=369 height=39type=audio/mpeg loop="-1" autostart="ture" volume="0"></P></TD></TR> </TBODY></TABLE></P>二、具体操作步骤1、在“BLOG发表文章”网页里,也即是写文章的网页里,写好文字后,选中文字上方的“查看HTML源代码”项(选项前的方框内出现√则为选中),这时我们看见原来的文字成了汉字、英文字母和一些诸如<、/、=等符号组成的乱码。