音乐播放器代码

合集下载

音乐播放器代码

音乐播放器代码

音频播放器代码(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=。

一个简单音乐播放器代码

一个简单音乐播放器代码

一个简单音乐播放器代码package bofang;import java.io.IOException;import com.example.bofang.R;import android.content.Intent;import android.media.MediaPlayer;import android.os.Bundle;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;public class Activity extends android.app.Activity{ private Button bt1;private Button bt2;private MediaPlayer player;//mediaplayer对象private boolean isplaying;//是否播放@Overrideprotected void onCreate(Bundle savedInstanceState) { // TODO自动生成的方法存根super.onCreate(savedInstanceState);setContentView(yout.activity);bt1=(Button)findViewById(R.id.bt1);bt2=(Button)findViewById(R.id.bt2);bt3.setOnClickListener(new OnClickListener() {bt1.setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View v) {// TODO自动生成的方法存根playOrpauseMusic();}});bt2.setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View v) {// TODO自动生成的方法存根stopMusic();}});init();}private void playOrpauseMusic() {// TODO自动生成的方法存根isplaying=player.isPlaying();if(isplaying){player.pause();bt1.setText("播放");}else{player.start();bt1.setText("暂停");//setimageresource(r.drawable.play)设置更换图片资源位置}bt2.setEnabled(true);}private void stopMusic() {// TODO自动生成的方法存根player.stop();bt1.setText("播放");bt2.setEnabled(false);try{ player.prepare();//为下次播放准备}catch(IllegalStateException e){e.printStackTrace();}catch(IOException e){e.printStackTrace();}player.seekTo(0);//定位音乐起始位置}private void init(){player=MediaPlayer.create(this,R.raw.cmsj);bt2.setEnabled(false);} }。

c语言编写的音乐播放器源代码)

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]);}。

安卓音乐播放器实现代码

安卓音乐播放器实现代码

1. Mp3Player.java 文件package com.jacky.multimedia;import java.io.File;import java.io.FilenameFilter;import java.io.IOException;import java.util.ArrayList;import java.util.List;import android.app.ListActivity;import android.media.MediaPlayer;import android.media.MediaPlayer.OnCompletionListener;import android.os.Bundle;import android.os.Handler;import android.view.KeyEvent;import android.view.View;import android.widget.ArrayAdapter;import android.widget.ImageButton;import android.widget.ListView;import android.widget.SeekBar;import android.widget.SeekBar.OnSeekBarChangeListener;import android.widget.TextView;public class Mp3Player extends ListActivity {/** Called when the activity is first created. *//* 定义5个图像按钮*/private ImageButton mFrontImageButton = null;private ImageButton mStartImageButton = null;private ImageButton mPauseImageButton = null;private ImageButton mStopImageButton = null;private ImageButton mNextImageButton = null;/*定义进度handler,显示百分比进度*/Handler mPercentHandler = new Handler();/*定义拖动条*/private SeekBar mSeekBar=null;/*定义显示文本框*/private TextView curProgressText=null;private TextView curtimeAndTotaltime=null;/* 定于一个多媒体对象*/public MediaPlayer mMediaPlayer = null;/*定于一个数据播放列表,用来存放从指定文件中搜索到的文件*/private List<String> mMusicList = new ArrayList<String>();/* 定义在播放列表中的当前选择项*/private int currentListItme = 0;/*定义要播放的文件夹路径*/private static final String MUSIC_PATH = new String("/mnt/sdcard/");/** Called when the activity is first created. */@Overridepublic void onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState);setContentView(yout.main);/* 更新播放列表*/musicList();/*初始化多媒体对象*/mMediaPlayer = new MediaPlayer();/*初始化图像按钮*/mFrontImageButton = (ImageButton) findViewById(stImageButton); mStopImageButton = (ImageButton) findViewById(R.id.StopImageButton); mStartImageButton = (ImageButton) findViewById(R.id.StartImageButton); mPauseImageButton = (ImageButton) findViewById(R.id.PauseImageButton); mNextImageButton = (ImageButton) findViewById(R.id.NextImageButton);/*初始化拖动条和当前进度显示值*/mSeekBar=(SeekBar)findViewById(R.id.SeekBar01);curProgressText=(TextView)findViewById(R.id.currentProgress); curtimeAndTotaltime=(TextView)findViewById(R.id.curtimeandtotaltime);/*监听停止按钮*/mStopImageButton.setOnClickListener(new ImageButton.OnClickListener() {@Overridepublic void onClick(View v){/*判断是否正在播放歌曲*/if (mMediaPlayer.isPlaying()){/*如果在播放歌曲时,按下开始按钮,则重开开始播放*/mMediaPlayer.reset();}}});/*监听开始按钮*/mStartImageButton.setOnClickListener(new ImageButton.OnClickListener(){@Overridepublic void onClick(View v){ /*播放当前选择歌曲,通过listView列表中onListItemClick方法得到选择的时第几项*/playMusic(MUSIC_PATH + mMusicList.get(currentListItme));/*开始播放歌曲时,同步进行更新拖动条进度*/startSeekBarUpdate();}});/*监听暂停按钮*/mPauseImageButton.setOnClickListener(new ImageButton.OnClickListener(){public void onClick(View view){if (mMediaPlayer.isPlaying()){/*如果有播放歌曲,暂停*/mMediaPlayer.pause();}else{/*如果没有播放歌曲,则开始播放*/mMediaPlayer.start();}}});/*监听下一首按钮*/mNextImageButton.setOnClickListener(new ImageButton.OnClickListener(){@Overridepublic void onClick(View arg0){nextMusic();}/*监听上一首按钮*/mFrontImageButton.setOnClickListener(new ImageButton.OnClickListener() {@Overridepublic void onClick(View arg0){FrontMusic();}});/*监听拖动条*/mSeekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser) {// TODO Auto-generated method stub/*如果拖动进度发生改变,则显示当前进度值*/curProgressText.setText("当前进度: "+progress);}@Overridepublic void onStartTrackingTouch(SeekBar seekBar) {// TODO Auto-generated method stubcurProgressText.setText("拖动中...");}@Overridepublic void onStopTrackingTouch(SeekBar seekBar) {// TODO Auto-generated method stubint dest = seekBar.getProgress();int mMax = mMediaPlayer.getDuration();int sMax = mSeekBar.getMax();mMediaPlayer.seekTo(mMax*dest/sMax);}});}/*按键处理时间,当按下返回按键时的处理方法*/public boolean onKeyDown(int keyCode, KeyEvent event){if ( keyCode == KeyEvent.KEYCODE_BACK){mMediaPlayer.stop();mMediaPlayer.release();this.finish();return true;}return super.onKeyDown(keyCode, event);}/*ListView选择项监听方法,即当前鼠标在列表中选择的第几项*/protected void onListItemClick(ListView l, View v, int position, long id){currentListItme = position;playMusic(MUSIC_PATH + mMusicList.get(position));}/*更新播放列表*/public void musicList(){/*从指定的路径中读取文件,并与播放列表关联*/File home = new File(MUSIC_PATH);/*读取指定类型的文件,在本程序,指定播放类型为mp3*/if (home.listFiles(new MusicFilter()).length > 0){/*读取文件*/for (File file : home.listFiles(new MusicFilter())){mMusicList.add(file.getName());}/*播放文件与播放列表关联*/ArrayAdapter<String> musicList = new ArrayAdapter<String>(Mp3Player.this,yout.musicitme, mMusicList); setListAdapter(musicList);}}/*播放指定路径中的音乐*/private void playMusic(String path){{/* 重置多媒体*/mMediaPlayer.reset();/*读取mp3文件*/mMediaPlayer.setDataSource(path);/*准备播放*/mMediaPlayer.prepare();/*开始播放*/mMediaPlayer.start();/*监听播放是否完成*/mMediaPlayer.setOnCompletionListener(new OnCompletionListener() {public void onCompletion(MediaPlayer arg0){/*播放完当前歌曲,自动播放下一首*/nextMusic();}});}catch (IOException e){}}/*播放下一首*/private void nextMusic(){if (++currentListItme >= mMusicList.size()){currentListItme = 0;}else{playMusic(MUSIC_PATH + mMusicList.get(currentListItme));}}/*播放上一首歌曲*/private void FrontMusic(){if (--currentListItme >= 0){currentListItme = 0;}{playMusic(MUSIC_PATH + mMusicList.get(currentListItme));}}/*更新拖动条进度*/public void startSeekBarUpdate(){mPercentHandler.post(start);}Runnable start=new Runnable(){@Overridepublic void run() {// TODO Auto-generated method stubmPercentHandler.post(updatesb);//用一个handler更新SeekBar}};Runnable updatesb =new Runnable(){@Overridepublic void run() {// TODO Auto-generated method stubint position = mMediaPlayer.getCurrentPosition();int mMax = mMediaPlayer.getDuration();int sMax = mSeekBar.getMax();mSeekBar.setProgress(position*sMax/mMax);curtimeAndTotaltime.setT ext("当前播放时间:"+position/1000+"秒"+"\n歌曲总时间: "+mMax/1000+"秒");mPercentHandler.postDelayed(updatesb, 1000);//每秒钟更新一次}};}/*播放文件选择类*/class MusicFilter implements FilenameFilter{public boolean accept(File dir, String name){/*指定扩展名类型*/return (name.endsWith(".mp3"));}}2.main.xls文件<?xml version="1.0" encoding="utf-8"?><AbsoluteLayoutxmlns:android="/apk/res/android" android:orientation="vertical"android:layout_width="fill_parent"android:layout_height="fill_parent"><ListViewandroid:id="@id/android:list"android:layout_width="fill_parent"android:layout_height="fill_parent"android:layout_weight="1"android:drawSelectorOnT op="false"/><ImageButtonandroid:id="@+id/LastImageButton"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_x="10px"android:layout_y="70px"android:src="@drawable/last"/><ImageButtonandroid:id="@+id/StopImageButton"android:layout_height="wrap_content"android:layout_width="wrap_content"android:layout_x="70px"android:layout_y="70px"android:src="@drawable/stop"/><ImageButtonandroid:id="@+id/StartImageButton"android:layout_height="wrap_content"android:layout_width="wrap_content"android:layout_x="130px"android:layout_y="70px"android:src="@drawable/start"/><ImageButtonandroid:id="@+id/PauseImageButton"android:layout_height="wrap_content"android:layout_width="wrap_content"android:layout_x="190px"android:layout_y="70px"android:src="@drawable/pause"/><ImageButtonandroid:id="@+id/NextImageButton"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_x="250px"android:layout_y="70px"android:src="@drawable/next"/><SeekBar android:id="@+id/SeekBar01"android:layout_height="wrap_content"android:layout_x="0dp"android:layout_y="200dp"android:layout_width="fill_parent"android:max="100"android:progress="0"android:secondaryProgress="50"android:visibility="visible"></SeekBar><TextView android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_y="250dp" android:id="@+id/currentProgress"></TextView><TextView android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_y="300dp" android:id="@+id/curtimeandtotaltime"></TextView></AbsoluteLayout>3.musictime.xls<?xml version="1.0" encoding="utf-8"?><TextView xmlns:android="/apk/res/android" android:id="@+id/T extView01"android:layout_width="fill_parent"android:layout_height="wrap_content"android:text="@string/hello"/>4.AndroidManifest.xls<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="/apk/res/android" package="com.jacky.multimedia"android:versionCode="1"android:versionName="1.0"><application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".Mp3Player"android:label="@string/app_name"><intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="UNCHER" /></intent-filter></activity></application><uses-sdk android:minSdkVersion="3" /></manifest>。

音乐播放器源代码

音乐播放器源代码

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源代码”项(选项前的方框内出现√则为选中),这时我们看见原来的文字成了汉字、英文字母和一些诸如<、/、=等符号组成的乱码。

用单片机制作简单音乐播放器代码

用单片机制作简单音乐播放器代码

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) {

视频音乐播放器代码大全

视频音乐播放器代码大全

视频音乐播放器代码大全(珍藏限量版)autostart="true"中true或1表示自动播放,false或0表示手动播放loop="true" 中的true或1表示重复播放,false或0表示只播放一次width= height= 中的数字分别表示播放器的宽度和高度=0表示隐藏播放器EnableContextMenu="0" 禁右键ShowStatusBar="1" (带显示文件播放信息)1隐藏播放器(不循环)代码:<EMBED src=音乐网址hidden=true type=audio/x-ms-wmaAUTOSTART="1">2.隐藏播放器(循环播放)代码:<EMBED src=音乐网址hidden=true type=audio/mpegAUTOSTART="1" loop="-1">3.黑色皮肤播放器代码:<EMBED style="FILTER: xray()" src=音乐网址width=360 height=30 type=audio/mpeg volume="0" autostart="true" loop="-1">4.淡蓝色播放器代码:<EMBED src=播放地址 width=300 height=45 type=audio/mpegloop="-1" autostart="1" volume="0">5.迷幻播放器代码:<TABLE style="FILTER: Alpha(Opacity=100, FinishOpacity=0, Style=2, StartX=20, StartY=40, FinishX=0, FinishY=0)gray(); WIDTH:400px; HEIGHT: 83px"><TBODY><TR><TD><EMBED src=播放地址 width=400 height=40 type=audio/mpeg panel="0" autostart="0" loop="true"></TD></TR></TBODY></TABLE>6.带菜单的播放器代码:<EMBEDpluginspage=/windows/mediaplayer/downlo ad/default.asp width=400 height=172 type=application/x-mplayer2 FileName="音乐网址" SHOWCONTROLS="1" SHOWSTATUSBAR="1" SHOWDISPLAY="1" SHOWGOTOBAR="1"AUTOSTART="true" PlayCount="1">7.深黄色带菜单播放器代码:<EMBED style="FILTER: invert()" src=音乐网址width=320 height=45 type=audio/x-ms-wma ShowStatusBar="1" loop="true"autostart="true">8.灰色播放器代码:<EMBED style="FILTER: Gray()" src="链接地址" width=300 height=69 type=application/x-mplayer2 loop="-1" showcontrols="1"ShowDisplay="0" ShowStatusBar="1" autostart="1"></EMBED>9.灰白色播放器代码:<embed style="FILTER: Gray()" src=链接地址width=300 height=45 loop="-1" autostart="true"></EMBED>10.带菜单的蓝色播放器代码:<EMBED src="链接地址" width=300 height=69type=application/x-mplayer2 loop="-1" showcontrols="1"ShowDisplay="0" ShowStatusBar="1" autostart="1"></EMBED>11.棕色播放器代码:<EMBED style="FILTER: invert()" src=链接地址width=300 height=45 loop="-1" autostart="true"></EMBED>12.带边框背景的播放器代码:<TABLE borderColor=#4F3256 background=背景图片地址 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>13.带背景图片的播放器代码:<TABLE borderColor=navy background=图片地址border=0><TBODY><TR><TD style="FILTER: alpha(opacity=80,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>12 13综合属性分析background=图片地址可以更换图片地址来实现改变播放器背景14.黄色闪光播放器代码:<TABLE style="BORDER-RIGHT: #000000 3px dashed; BORDER-TOP: #000000 3px dashed; BORDER-LEFT: #000000 3px dashed; BORDER-BOTTOM: #000000 3px dashed" cellSpacing=0cellPadding=0 bgColor=#00000><TBODY><TR><TD><TABLE borderColor=navybackground=/s-helpSite/domName/nxm/20041114123131568.gif 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>15.蓝色闪光播放器代码:<TABLE borderColor=#dee4fe cellSpacing=3 cellPadding=0 background=/UploadFile/2004-12/2004123023 101352.gif border=2><TBODY><TR><TD><TABLE align=centerborder=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>16.带花边的播放器代码:<TABLE style="BORDER-RIGHT: #000000 3px dashed; BORDER-TOP: #000000 3px dashed; BORDER-LEFT: #000000 3px dashed; BORDER-BOTTOM: #000000 3px dashed" cellSpacing=0cellPadding=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>17.粉色花边播放器代码:<TABLE style="BORDER-RIGHT: #ff69b4 3px dotted; BORDER-TOP: #ff69b4 3px dotted; BORDER-LEFT: #ff69b4 3px dotted;BORDER-BOTTOM: #ff69b4 3px dotted" cellSpacing=0cellPadding=0 align=center bgColor=white><TBODY><TR><TD><TABLE borderColor=#ff69b4 align=center bgColor=#ffccf5border=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>18.显示文件标签灰色播放器代码:<DIV><EMBED style="FILTER: Gray()" 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>19显示文件标签棕色播放器代码:<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>20.显示文件标签黑色播放器代码:<DIV><EMBED style="FILTER: xray()" 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>21.连放播放器代码:<EMBED style="FILTER: Gray()" src=音乐网址width=500 height=35 type=audio/x-ms-wma controls="StatusBar,TACCtrl,ControlPanel"border="0" autostart="1" playcount="0" showtracker="1"volume="0"></EMBED>22.彩色播放器代码:<TABLE style="FONT-WEIGHT: normal; FONT-SIZE: 12px; COLOR: 00CCFF; FONT-STYLE: normal; FONT-FAMILY: Tahoma, Verdana; FONT-VARIANT: normal" cellSpacing=0 cellPadding=0 width=140border=0><TBODY><TR><TD style="BACKGROUND-COLOR:00CCFF"><EMBED style="FILTER: invert alpha(opacity=50) WIDTH: 140px; HEIGHT: 45px" src=音乐链接地址type=video/x-ms-asf autostart="FALSE" loop="-1"volume="0"></EMBED></TD></TR></TBODY></TABLE>本代码属性分析BACKGROUND-COLOR: 00CCFF播放器颜色代码可以更换以变换播放器颜色23.透明播放器代码代码:<TABLE style="FILTER: Alpha(Opacity=100, FinishOpacity=0, Style=2, StartX=20, StartY=40, FinishX=0, FinishY=0)xray(); WIDTH:200px; HEIGHT: 40px"><TBODY><TR><TD><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=30 type=audio/x-mplayer2 loop="-1" autostart="0" volume="0"EnableContextMenu="0" showstatusbar="0"console="video"></TD></TR></TBODY></TABLE><p><span style="font-family:楷体;font-size:small;color:#156200;"><strong>&nbsp;&nbsp;&nbsp; <a href="">茶艺茗国际商城</a></strong>直供<strong><a href="/Product.aspx?BigId=1&amp;SmallId=7">正品铁观音</a></strong>、西湖龙井、<strong><a href="/Product.aspx?BigId=3&amp;SmallId=15">云南普洱</a></strong>、红茶等中国各大<strong><a href="/61/">品牌茗茶</a></strong>,及其它<strong><a href="/Product.aspx?BigId=5&amp;SmallId=0">保健茶</a></strong>、茶食品、茶具等相关产品。

android音乐播放器---源代码

android音乐播放器---源代码
android:layout_width="fill_parent" android:layout_height="fill_parent"
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" />

音乐播放器代码大全

音乐播放器代码大全

音乐播放器代码大全单曲音乐代码大全:autostart="true"中true或1表示自动播放,false或0表示手动播放loop="true" 中的true或1表示重复播放,false或0表示只播放一次width= height= 中的数字分别表示播放器的宽度和高度 =0表示隐藏播放器EnableContextMenu="0" 禁右键ShowStatusBar="1" (带显示文件播放信息)1隐藏播放器(不循环)代码:<EMBED src=音乐网址hidden=true type=audio/x-ms-wma AUTOSTART="1">2.隐藏播放器(循环播放)代码:<EMBED src=音乐网址hidden=true type=audio/mpeg AUTOSTART="1" loop="-1">3.黑色皮肤播放器代码:<EMBED style="FILTER: xray()" src=音乐网址width=360 height=30 type=audio/mpeg volume="0" autostart="true" loop="-1">4.淡蓝色播放器代码:<EMBED src=播放地址width=300 height=45 type=audio/mpeg loop="-1" autostart="1" volume="0">5.迷幻播放器代码:<TABLE style="FILTER: Alpha(Opacity=100, FinishOpacity=0, Style=2, StartX=20, StartY=40, FinishX=0, FinishY=0)gray(); WIDTH: 400px; HEIGHT: 83px"><TBODY><TR><TD><EMBED src=播放地址width=400 height=40 type=audio/mpeg panel="0" autostart="0" loop="true"> </TD></TR></TBODY></TABLE>6.带菜单的播放器代码:<EMBED pluginspage= width=400 height=172 type=application/x-mplayer2 FileName="音乐网址" SHOWCONTROLS="1" SHOWSTATUSBAR="1" SHOWDISPLAY="1" SHOWGOTOBAR="1" AUTOSTART="true" PlayCount="1">7.深黄色带菜单播放器代码:<EMBED style="FILTER: invert()" src=音乐网址width=320 height=45 type=audio/x-ms-wma ShowStatusBar="1" loop="true" autostart="true">8.灰色播放器代码:<EMBED style="FILTER: Gray()" src="链接地址" width=300 height=69 type=application/x-mplayer2 loop="-1" showcontrols="1" ShowDisplay="0" ShowStatusBar="1" autostart="1"></EMBED>9.灰白色播放器代码:<embed style="FILTER: Gray()" src=链接地址width=300 height=45 loop="-1" autostart="true"></EMBED>10.带菜单的蓝色播放器代码:<EMBED src="链接地址" width=300 height=69 type=application/x-mplayer2 loop="-1" showcontrols="1" ShowDisplay="0" ShowStatusBar="1" autostart="1"></EMBED>11.棕色播放器代码:<EMBED style="FILTER: invert()" src=链接地址width=300 height=45 loop="-1" autostart="true"></EMBED>12.带边框背景的播放器代码:<TABLE borderColor=#4F3256 background=背景图片地址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>13.带背景图片的播放器代码:<TABLE borderColor=navy background=图片地址border=0> <TBODY><TR><TD style="FILTER: alpha(opacity=80,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>12 13综合属性分析background=图片地址可以更换图片地址来实现改变播放器背景14.黄色闪光播放器代码:<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=navy background= 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>15.蓝色闪光播放器代码:<TABLE borderColor=#dee4fe cellSpacing=3 cellPadding=0 background= 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></TBO DY></TABLE>16.带花边的播放器代码:<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>17.粉色花边播放器代码:<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=300height=25 type=audio/mpeg volume="0" autostart="false" loop="-0"></P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>18.显示文件标签灰色播放器代码:<DIV><EMBED style="FILTER: Gray()" 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>19显示文件标签棕色播放器代码:<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>20.显示文件标签黑色播放器代码:<DIV><EMBED style="FILTER: xray()" 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>21.连放播放器代码:<EMBED style="FILTER: Gray()" src=音乐网址width=500 height=35 type=audio/x-ms-wma controls="StatusBar,TACCtrl,ControlPanel" border="0" autostart="1" playcount="0" showtracker="1" volume="0"></EMBED>22.彩色播放器代码:<TABLE style="FONT-WEIGHT: normal; FONT-SIZE: 12px; COLOR: 00CCFF; FONT-STYLE: normal; FONT-FAMILY: Tahoma, Verdana; FONT-VARIANT: normal" cellSpacing=0 cellPadding=0 width=140 border=0><TBODY><TR><TD style="BACKGROUND-COLOR: 00CCFF"><EMBED style="FILTER: invert alpha(opacity=50) WIDTH: 140px; HEIGHT: 45px" src=音乐链接地址 type=video/x-ms-asf autostart="FALSE" loop="-1"volume="0"></EMBED></TD></TR></TBODY></TABLE>本代码属性分析BACKGROUND-COLOR: 00CCFF 播放器颜色代码可以更换以变换播放器颜色23.透明播放器代码代码:<TABLE style="FILTER: Alpha(Opacity=100, FinishOpacity=0, Style=2, StartX=20, StartY=40, FinishX=0, FinishY=0)xray(); WIDTH: 200px; HEIGHT: 40px"><TBODY><TR><TD><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=30 type=audio/x-mplayer2 loop="-1" autostart="0" volume="0" EnableContextMenu="0" showstatusbar="0" console="video"></TD></TR></TBODY></TABLE>。

android音乐播放器代码

android音乐播放器代码

81.});
82.
83.forwardBtn.setOnTouchListener(new OnTouchListener() { //点击“快进”按钮时回调
84. @Override
85. public boolean onTouch(View v, MotionEvent event) {
01./*变量声明*/
02.private ImageButton playBtn = null;//播放、暂停
03.private ImageButton latestBtn = null;//上一首
04.private ImageButton nextButton = null;//下一首
37.playBtn.setOnClickListener(new View.OnClickListener() { //点击“播放、暂停”按钮时回调
38. @Override
39. public void onClick(View v) {
testBtn = (ImageButton)findViewById(testBtn); //播放上一首按钮
31.nextButton = (ImageButton)findViewById(R.id.nextBtn); //播放下一首按钮
32.forwardBtn = (ImageButton)findViewById(R.id.forwardBtn); //快进按钮
64. play(); //开始播放
65. }
66.});
67.
68.nextButton.setOnClickListener(new View.OnClickListener(){//点击“播放下一首”按钮时回调

音频播放器代码-代码大全

音频播放器代码-代码大全

音频播放器代码-代码大全播放器样式和代码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编程源代码)

音乐播放器(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总结:本音乐播放器的界面还可以设计的更加漂亮好看,这个就得发挥你的界面设计能力咯!以上播放器的设计还有很多可以改善的地方,比如代码能否更加简化?还缺少哪些功能?如何更加赏心悦目?这些就交给你自己去完善咯!另外,为了方便有兴趣的人更好的理解整个设计过程,我已共享该音乐播放器程序设计的整个工程文件(本程序用到的图片也含有)到以下网址:可以下载看看,希望对你有所帮助!。

安卓简单的音乐播放代码

安卓简单的音乐播放代码

1. [代码][Java]代码view sourceprint?001 package com.yongzheng.mymusic;002003 import java.io.File;004 import java.io.IOException;005 import java.util.ArrayList;006 import java.util.HashMap;007 import java.util.List;008 import java.util.Map;009 import java.util.Timer;010 import java.util.TimerTask;011012 import android.media.AudioManager;013 import android.media.MediaPlayer;014 import android.media.MediaPlayer.OnCompletionListener; 015 import android.media.MediaPlayer.OnErrorListener;016 import android.media.MediaPlayer.OnPreparedListener; 017 import android.os.Bundle;018 import android.os.Environment;019 import android.os.Handler;020 import android.os.Message;021 import android.annotation.SuppressLint;022 import android.app.Activity;023 import android.content.DialogInterface;024 import android.view.Menu;025 import android.view.View;026 import android.view.View.OnClickListener;027 import android.widget.AdapterView;028 import android.widget.AdapterView.OnItemClickListener; 029 import android.widget.Button;030 import android.widget.ListView;031 import android.widget.SeekBar;032 import android.widget.SimpleAdapter;033 import android.widget.TextView;034 import android.widget.Toast;035036 public class MainActivity extends Activity{037038 private TextView musicName ;//歌曲名称039 private TextView startTime;//播放时间040 private TextView endTime;//结束时间041 private SeekBar seekbar;//进度条042043 private Button start;//开始按钮044 private Button pause;//暂停按钮045 private Button restart;//重新开始046 private Button stop;//停止按钮047048 private ListView mylist;//列表049 private SimpleAdapter adapter = null; // 适配器050051 private Timer timer;052053 private MediaPlayer media = null;054 private List<Map<String, String>> musicListData;055056 private String lastPlayName = null;//记录最后一次播放的歌曲057058 @Override059 protected void onCreate(Bundle savedInstanceState) { 060 super.onCreate(savedInstanceState);061 setContentView(yout.activity_main);062 init();063 }064065 //初始化066 private void init(){067068 musicListData =069 new ArrayList<Map<String, String>>(); // 保存所有的List数据070071 this.musicName = (TextView) this.findViewById(R.id.musicName); 072 this.startTime = (TextView)this.findViewById(R.id.startTime); 073 this.endTime = (TextView)this.findViewById(R.id.endTime);074 this.seekbar = (SeekBar)this.findViewById(R.id.seekbar);075 this.start = (Button)this.findViewById(R.id.start);076 this.pause = (Button)this.findViewById(R.id.pause);077 this.restart = (Button)this.findViewById(R.id.restart);078 this .stop = (Button)this .findViewById(R.id.stop);079 this .mylist = (ListView)this .findViewById(R.id.mylist);080 addList();081 //点击事件082 this .start.setOnClickListener(new MyClickListener());083 this .pause.setOnClickListener(new MyClickListener());084 this .restart.setOnClickListener(new MyClickListener());085 this .stop.setOnClickListener(new MyClickListener());086087 this .seekbar.setOnSeekBarChangeListener(new SeekBarOnClickListenerImpl());088 //开启搜索sd 卡中MP3文件的线程089 new Thread(){090 public void run(){091 getMusicDate();//搜索sd 卡下面的mp3后缀的文件092 }093 }.start();094 }095096 //待搜索线程完成后,执行这个添加数据到界面上097 public void addList(){098 this .adapter = new SimpleAdapter(this ,this .musicListData,yout.list,099 new String[]{"name","size"},new int []{,R.id.size});100 this .mylist.setAdapter(adapter);101 this .mylist.setOnItemClickListener(new OnItemClickListener() {102 @Override103 public void onItemClick(AdapterView<?> adapt, View v, int postition,104 long id) {105 Map<String,String> map = MainActivity.this .musicListData.get(postition);106 if (MainActivity.this .media!=null ){107 stop();108 }109 play(map.get("path"));110 }111 });112 }113114 //获取播放列表115 public void getMusicDate(){116117 if(!(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED ))){118 //如果不sd卡存在119 return;120 }121 File rootPath = Environment.getExternalStorageDirectory(); 122 File[] listFile = rootPath.listFiles();123 if(listFile!=null){124 for(File f : listFile){125 if(f.isDirectory()){//如果是目录126 System.out.println("根文件夹:"+f.getName()); 127 getFile(f);128 }else{//如果是文件129 getAFile(f);130 }131 }132 }133134 Message message = new Message();135 message.what = 3;136 MainActivity.this.handler.sendMessage(message);137 return;138 }139140 //文件141 private void getAFile(File f){142 String fName = f.getName();143 if(!fName.endsWith("mp3")){144 return;145 }146 Map<String,String> map = new HashMap<String,String>();147 map.put("name",fName);148 map.put("size", String.valueOf(f.length()/1024/1024)+"MB"); 149 map.put("path",f.getAbsolutePath());150 musicListData.add(map);151 System.out.println("音乐文件路径:"+f.getAbsolutePath()); 152 }153 //路径154 private void getFile(File f){155 if(!f.isDirectory()){156 getAFile(f);157 return;158 }159 File[] listFile = f.listFiles();160 if(listFile!=null){161 for(File ff : listFile){162 if(f.isDirectory()){//如果是目录163 System.out.println("文件夹:"+ff.getName()); 164 getFile(ff);165 }else{//如果是文件166 System.out.println("文件:"+ff.getName()); 167 getAFile(ff);168 }169 }170 }171 }172173 //进度条监听回调174 private class SeekBarOnClickListenerImpl implementsSeekBar.OnSeekBarChangeListener {175176 @Override177 public void onProgressChanged(SeekBar seekBar, int progress, 178 boolean fromUser) {179 if(!fromUser)return;180 if(MainActivity.this.media!=null){181182 Message message = new Message();183 Bundle b = new Bundle();184 b.putInt("p", progress);185 message.setData(b);186 message.what = 2;187 MainActivity.this.handler.sendMessage(message);188 MainActivity.this.media.seekTo(progress);189 }190 }191192 @Override193 public void onStartTrackingTouch(SeekBar seekBar) {194 // TODO Auto-generated method stub195196 }197198 @Override199 public void onStopTrackingTouch(SeekBar seekBar) {200201 }202203 }204205 //播放控制的按钮事件206 class MyClickListener implements OnClickListener{207208 @Override209 public void onClick(View v) {210 switch(v.getId()){211 case R.id.start:212play(Environment.getExternalStorageDirectory()+File.separator+"my.mp3"); 213 break;214 case R.id.pause:215 pause();break;216 case R.id.restart:217 restart();break;218 case R.id.stop:219 stop();break;220 }221 }222223 }224225226 @Override227 public boolean onCreateOptionsMenu(Menu menu) {228 // Inflate the menu; this adds items to the action bar if it is present. 229 getMenuInflater().inflate(R.menu.main, menu);230 return true;231 }232233 //停止播放234 private void stop(){235 if(MainActivity.this.media!=null){236 MainActivity.this.start.setClickable(true); 237 MainActivity.this.media.release();238 MainActivity.this.media = null;239 }240 }241242 //从头开始播放243 private void restart(){244 if(MainActivity.this.media!=null){245 MainActivity.this.media.seekTo(0);246 }247 }248249 //暂停获取继续播放250 private void pause(){251 if(MainActivity.this.media==null){252 MainActivity.this.pause.setText("暂停"); 253 return;254 }255 if("继续".equals(MainActivity.this.pause.getText().toString())){ 256 MainActivity.this.media.start();257 MainActivity.this.pause.setText("暂停");258 }else if(MainActivity.this.media.isPlaying()){259 MainActivity.this.media.pause();260 MainActivity.this.pause.setText("继续");261 }262 }263264 //开始播放265 private void play(String path){266 if(path==null||"".equals(path)){267 Toast.makeText(this, "请选择播放文件", Toast.LENGTH_SHORT); 268 return;269 }270 this.musicName.setText(path.substring(stIndexOf("/")+ 1)); 271 File file = new File(path);272 if(file.exists()&&file.length()>0){273 try {274 this.media = new MediaPlayer();275 this .media.setAudioStreamType(AudioManager.STREAM_MUSIC);//设置播放类型276 this .media.setDataSource(path);277 this .media.setOnCompletionListener(new MediaCompletionListener());278 this .media.setOnErrorListener(new MediaErrorListener());279 this .media.prepare();280 this .media.start();281 this .start.setClickable(false );282 //启动事件更新及进度条更新任务,每0.5s 更新一次283 MainActivity.this .timer = new Timer();284 MainActivity.this .timer.schedule(new MyTask(), 0, 1000);285 } catch (Exception e) {286 e.printStackTrace();287 Toast.makeText(this , "播放文件错误", Toast.LENGTH_SHORT).show();288 }289290 }else {291 Toast.makeText(this , "播放文件不存在", Toast.LENGTH_SHORT).show();292 }293 }294295 @Override296 protected void onDestroy() {297 super.onDestroy();298299 if(this.media != null) { //如果播放器对象不为空300 this.media.release(); //释放播放器资源301 this.media = null; //设置对象为空302 }303 }304305 @SuppressLint("HandlerLeak")306 private Handler handler = new Handler() {307 public void handleMessage(Message msg) {308 switch(msg.what) {309 case1:310 if(MainActivity.this.media != null) {311 int progress =MainActivity.this.media.getCurrentPosition(); //当前播放毫秒312 int allTime = MainActivity.this.media.getDuration();//总毫秒313 MainActivity.this.seekbar.setMax(allTime);//设置进度条314MainActivity.this.startTime.setText(getTimeFormat(progress));315MainActivity.this.endTime.setText(getTimeFormat(allTime));316 MainActivity.this.seekbar.setProgress(progress);317 }318 break;319 case2:320 break;321 case3:322 addList();323 break;324 }325326 super.handleMessage(msg);327 }328 };329330 private String getTimeFormat(int time) {331 String timeStr = "00:00:00";332 int s = time/1000; //秒333 int h = s / 3600; //求整数部分,小时334 int r = s % 3600; //求余数335 int m = 0;336 if(r > 0) {337 m = r / 60; //分338 r = r % 60; //求分后的余数,即为秒339 }340341 if(h < 10) {342 timeStr = "0" + h;343 } else {344 timeStr = "" + h;345 }346347 if(m < 10) {348 timeStr = timeStr + ":" + "0" + m; 349 } else {350 timeStr = timeStr + ":" + m;351 }352353 if(r < 10) {354 timeStr = timeStr + ":" + "0" + r;355 } else {356 timeStr = timeStr + ":" + r;357 }358359 return timeStr;360 }361362363 private class MyTask extends TimerTask {364365 @Override366 public void run() {367 Message message = new Message();368 message.what = 1;369 MainActivity.this.handler.sendMessage(message); 370 }371 }372373 //播放时候错误回调374 private class MediaErrorListener implements OnErrorListener{375 @Override376 public boolean onError(MediaPlayer arg0, int arg1, int arg2) {377 MainActivity.this .media.stop();378 MainActivity.this .media.release();379 MainActivity.this .media = null ;380 Toast.makeText(MainActivity.this , "播放时候遇到错误,播放停止", Toast.LENGTH_LONG).show();381 return false ;382 }383 }384 //播放完成事件385 private class MediaCompletionListener implements OnCompletionListener{386 @Override387 public void onCompletion(MediaPlayer arg0) {388 MainActivity.this .media.stop();389 MainActivity.this .media.release();390 MainActivity.this .media = null ;391 MainActivity.this .musicName.setText("当前没有播放");392 MainActivity.this.startTime.setText("00:00"); 393 MainActivity.this.endTime.setText("00:00"); 394 MainActivity.this.start.setClickable(true); 395 }396397 }398 }。

音乐播放器程序源代码及注释

音乐播放器程序源代码及注释

音乐播放器程序源代码及注释:#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. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

以下为一款音乐播放器代码,长度(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">&copy;<br><div class="bottomx"><a><font color=slategray size=4>本站网址/zb 感谢转发微博、空间的朋友!谢谢你们!</a><div><p></p><font color="#777777"><a>友情连接:&nbsp;&nbsp;<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>&nbsp;&nbsp;<ahref="/" target="_blank"><font color=slategray size=2>4399游戏</a>&nbsp;&nbsp;<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>&nbsp;&nbsp;<ahref="/?pid=mm_34029538_3439848_11149737" target="_blank"><font color=slategray size=2>爱淘宝</a>&nbsp;&nbsp;<ahref="/?pid=mm_34029538_3439848_11149737&tb_lm_id=l_sczl_sogou_cyg j" target="_blank"><font color=slategray size=2>一淘专享</a>&nbsp;&nbsp;<ahref="/go/act/taoke/ai_crown.php?pid=mm_34029538_3439848_1114973 7&unid=" target="_blank"><font color=slategraysize=2>TOP10店铺</a>&nbsp;&nbsp;<a href="/" target="_blank"><font color=slategray size=2>时光网址导航</a>&nbsp;&nbsp;<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 &copy; 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>&nbsp;西部数码<ahref="/index.asp?ReferenceID=684929"target="_blank"><font color=slategray size=2>虚拟主机</a>&nbsp;&nbsp;</a><a href="/jtyy/" target="_blank"><font color=slategray size=2>家庭影院</a><b></TABLE></body></html>。

相关文档
最新文档