Android视频播放器代码

Android视频播放器代码
Android视频播放器代码

Java代码部分:

import java.io.IOException;

import java.util.Random;

import android.app.Activity;

import android.content.Context;

import https://www.360docs.net/doc/b116990016.html,NotFoundException;

import android.media.AudioManager;

import android.media.MediaPlayer;

import android.media.MediaPlayer.OnBufferingUpdateListener;

import android.media.MediaPlayer.OnCompletionListener;

import android.os.Bundle;

import android.os.Handler;

import android.view.GestureDetector.OnGestureListener;

import android.view.Gravity;

import android.view.MotionEvent;

import android.view.SurfaceHolder;

import android.view.SurfaceView;

import android.view.View;

import android.view.Window;

import android.view.WindowManager;

import android.view.View.OnClickListener;

import android.view.View.OnTouchListener;

import android.widget.ImageButton;

import android.widget.LinearLayout;

import https://www.360docs.net/doc/b116990016.html,youtParams;

import android.widget.PopupWindow;

import android.widget.SeekBar;

import android.widget.SeekBar.OnSeekBarChangeListener;

import android.widget.TextView;

import android.widget.Toast;

public class PlayVideo extends Activity implements

OnGestureListener,

OnClickListener,// 监听

OnBufferingUpdateListener,// 当网络缓冲数据流变化的时候唤起的播放事件

OnCompletionListener,// 当媒体资源在播放的时候到达终点时唤起的播放事件

MediaPlayer.OnPreparedListener,

SurfaceHolder.Callback// 回调函数

{

// 视频高和宽

int videoWidth;

int videoHeight;

// 按钮

ImageButton play;

//定义快进按钮

ImageButton fastPlay;

//定义快退按钮

ImageButton fastBack;

// 控制栏

LinearLayout layout_control; LinearLayout layout_prograss; LinearLayout videoBack;

// 用来播放媒体

MediaPlayer mediaPlayer; // 显示媒体

SurfaceView surView;

// 用来控制SurfaceView SurfaceHolder surHolder;

// 路径

String path;

// 是否是播放状态

boolean boTing = true;

//获取播放的位置

int num;

//点击屏幕次数

int count;

//第一次点击

int firClick;

//第二次点击

int secClick;

//通过flag判断是否全屏

boolean flag;

//播放进度条

SeekBar seekbar;

//显示时间组建

TextView showTime;

//播放文件的时间

int minute;

int second;

//进度条进度

int progress;

//线程控制

MyThread mt;

//声音控制

SeekBar sound;

//声音进度

int soundId;

//显示音量

TextView showSound;

//接取拖动进度条

int videoLength;

boolean f = true;

//播放尺寸

//按钮隐藏时间

int hint = 5000;

//用于接取点击ListView位置

int position;

//声称随机数

Random random;

//通过buttonFlag判断按钮背景

boolean buttonFlag = true;

//显示视频总时间

TextView allTime;

TextView distant;

PopupWindow popuWindow;

View view;

boolean popFlag ;

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_NO_TITLE);

this.getWindow().setFlags(https://www.360docs.net/doc/b116990016.html,youtParams.FLAG_FULLSCREEN, https://www.360docs.net/doc/b116990016.html,youtParams.FLAG_FULLSCREEN);

setContentView(https://www.360docs.net/doc/b116990016.html,yout.video);

// 产生对象

view = this.getLayoutInflater().inflate(https://www.360docs.net/doc/b116990016.html,yout.popuwindow, null);

//得到布局的ID

videoBack = (LinearLayout)view.findViewById(R.id.videoback);

// 产生对象

play = (ImageButton) view.findViewById(R.id.video_bu_bofang);

layout_control = (LinearLayout)findViewById(https://www.360docs.net/doc/b116990016.html,yout_control);

layout_prograss= (LinearLayout)findViewById(https://www.360docs.net/doc/b116990016.html,yout_prograss);

seekbar = (SeekBar)view.findViewById(R.id.seekbar);

showTime = (TextView)view.findViewById(R.id.showtime);

fastPlay = (ImageButton)view.findViewById(R.id.fastplay);

fastBack = (ImageButton)view.findViewById(R.id.fastback);

sound = (SeekBar)view.findViewById(R.id.sound);

showSound = (TextView)view.findViewById(R.id.showsound);

surView = (SurfaceView) findViewById(R.id.surfaceview_1);

allTime = (TextView)view.findViewById(R.id.alltime);

distant = (TextView)findViewById(R.id.distant);

surHolder = surView.getHolder();

popuWindow = new PopupWindow(view, LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT);

// 设置回调函数

surHolder.addCallback(this);

// 设置风格

surHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);

//bu_boFang.setVisibility(View.INVISIBLE);

// 设置按键监听

play.setOnClickListener(this);

//快进监听

fastPlay.setOnClickListener(this);

//快退按钮监听

fastBack.setOnClickListener(this);

//new随机数对象

random = new Random();

//接取到播放列表中点击的位置

position = VideoList.position;

try {

//获取ShareActivity上下文

VideoList.context = createPackageContext("https://www.360docs.net/doc/b116990016.html,.iotek", Context.CONTEXT_IGNORE_SECURITY);

VideoList.share = VideoList.context.getSharedPreferences("setupadapter", VideoList.context.MODE_WORLD_READABLE);

VideoList.editor = VideoList.share.edit();

} catch (NameNotFoundException e) {

e.printStackTrace();

}

//对读取的信息进行判断

if (VideoList.share.getString("hinttime", "5秒").equals("5秒")) {

hint = 5000;

}

if (VideoList.share.getString("hinttime", "5秒").equals("10秒")) {

hint = 10000;

}

if (VideoList.share.getString("hinttime", "5秒").equals("15秒")) {

hint = 15000;

}

//设置全屏播放

surView.setOnTouchListener(new OnTouchListener() {

@Override

public boolean onTouch(View v, MotionEvent event) {

// TODO Auto-generated method stub

// handler.sendEmptyMessageAtTime(0x11, 3000);

if(MotionEvent.ACTION_DOWN == event.getAction()){

count++;

if(count == 1){

new countClear().start();

firClick = (int) System.currentTimeMillis();

if (!popFlag) {

// // // popuWindow = new PopupWindow(view, LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT);

popuWindow.showAtLocation(view, Gravity.BOTTOM, 0, 0);

popFlag = true;

handler.removeMessages(0x11);

handler.sendEmptyMessageDelayed(0x11, hint);

}

//设置layout显示

// if (!flag) {

/* layout_control.setVisibility(View.VISIBLE);

layout_prograss.setVisibility(View.VISIBLE);*/

//点击surfaceView延时3S发送信息

/* handler.removeMessages(0x11);

handler.sendEmptyMessageDelayed(0x11, hint);*/

// }

} else if (count == 2){

secClick = (int) System.currentTimeMillis();

if(secClick - firClick < 1000){

flag = !flag;

count = 0;

}

if(flag){

distant.setHeight(0);

surView.setLayoutParams(new

https://www.360docs.net/doc/b116990016.html,youtParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

surHolder.setFixedSize(480, 760);

if (!popFlag) {

// popuWindow = new PopupWindow(view, LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT);

popuWindow.showAtLocation(view, Gravity.BOTTOM, 0, 0);

popFlag = true;

handler.removeMessages(0x11);

handler.sendEmptyMessageDelayed(0x11, hint);

}

// 开始播放

// mePlayer.start();

}else{

if (VideoList.share.getString("size", "4:3").equals("4:3")) {

surView.setLayoutParams(new

https://www.360docs.net/doc/b116990016.html,youtParams(LayoutParams.MATCH_PARENT, 360));

surHolder.setFixedSize(480, 360);

distant.setHeight(250);

if (!popFlag) {

// popuWindow = new PopupWindow(view, LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT);

popuWindow.showAtLocation(view,

Gravity.BOTTOM, 0, 0);

popFlag = true;

handler.removeMessages(0x11);

handler.sendEmptyMessageDelayed(0x11, hint);

}

}

if (VideoList.share.getString("size", "4:3").equals("16:9")) {

surView.setLayoutParams(new

https://www.360docs.net/doc/b116990016.html,youtParams(LayoutParams.MATCH_PARENT, 270));

surHolder.setFixedSize(480, 270);

distant.setHeight(250);

if (!popFlag) {

// popuWindow = new PopupWindow(view, LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT);

popuWindow.showAtLocation(view,

Gravity.BOTTOM, 0, 0);

popFlag = true;

handler.removeMessages(0x11);

handler.sendEmptyMessageDelayed(0x11, hint);

}

}

}

count = 0;

firClick = 0;

secClick = 0;

}

}

return true;

}

});

//监听进度条进度

seekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

@Override

public void onStopTrackingTouch(SeekBar seekBar) {

videoLength = seekBar.getProgress();

// int q = mediaPlayer.getCurrentPosition();

mediaPlayer.seekTo(videoLength);

//获取进度条当前的位置

// int dest = seekBar.getProgress();

//设置播放器当期的播放位置

// mediaPlayer.seekTo(num);

}

@Override

public void onStartTrackingTouch(SeekBar seekBar) {

}

@Override

public void onProgressChanged(SeekBar seekBar, int progress,

boolean fromUser) {

//得到seekbar的进度

/* seekbar.setProgress(progress);

videoLength = seekBar.getProgress();*/

}

});

sound.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { @Override

public void onStopTrackingTouch(SeekBar seekBar) {

// TODO Auto-generated method stub

int i= seekBar.getProgress();

mediaPlayer.setVolume(i/100f,i/100f);

}

@Override

public void onStartTrackingTouch(SeekBar seekBar) {

// TODO Auto-generated method stub

}

@Override

public void onProgressChanged(SeekBar seekBar, int progress,

boolean fromUser) {

// TODO Auto-generated method stub

int i= sound.getProgress();

showSound.setText("音量:"+i);

handler.removeMessages(0x11);

handler.sendEmptyMessageDelayed(0x11, hint);

}

});

}

private void playVideo(){

// 构建MediaPlayer对象

mediaPlayer = new MediaPlayer();

try {

// 设置媒体文件路径

mediaPlayer.setDataSource(VideoList.path);

// 设置通过SurfaceView来显示画面

mediaPlayer.setDisplay(surHolder);

// 准备

mediaPlayer.prepare();

distant.setHeight(200);

// 设置事件监听

mediaPlayer.setOnBufferingUpdateListener(this);

mediaPlayer.setOnCompletionListener(this);

mediaPlayer.setOnPreparedListener(this);

mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);

seekbar.setMax(mediaPlayer.getDuration());

//设置当前播放音量最大

soundId = sound.getProgress();

mediaPlayer.setVolume(soundId, soundId);

showSound.setText("音量:"+soundId);

mt = new MyThread();

mt.start();

handler.sendEmptyMessage(0x13);

int n = mediaPlayer.getDuration();//获得持续时间

seekbar.setMax(n);

n = n/1000;

int m = n/60;

int h = m/60;

int s = n%60;

m = m%60;

allTime.setText(String.format("影片长度:"+"%02d:%02d:%02d", h,m,s));

} catch (IllegalArgumentException e) {

e.printStackTrace();

} catch (IllegalStateException e) {

e.printStackTrace();

} catch (IOException e) {

e.printStackTrace();

}

}

// MediaPlayer.OnPreparedListener

public void onCompletion(MediaPlayer mp) {

handler.sendEmptyMessage(0x14);

}

// MediaPlayer.OnPreparedListener

// 这时能确保player处于Prepared状态,触发start是最合适的

public void onPrepared(MediaPlayer mp) {

if (VideoList.share.getString("size", "4:3").equals("4:3")) {

surView.setLayoutParams(new

https://www.360docs.net/doc/b116990016.html,youtParams(LayoutParams.MATCH_PARENT, 360));

// 设置播放视频的宽度和高度

surHolder.setFixedSize(480, 360);

// 开始播放

mediaPlayer.start();

}

if (VideoList.share.getString("size", "4:3").equals("16:9")) {

// 设置播放视频的宽度和高度

surView.setLayoutParams(new

https://www.360docs.net/doc/b116990016.html,youtParams(LayoutParams.MATCH_PARENT, 270));

surHolder.setFixedSize(480, 270);

// 开始播放

mediaPlayer.start();

}

}

public void surfaceCreated(SurfaceHolder holder) {

playVideo();

}

public void surfaceChanged(SurfaceHolder holder, int format, int width,

int height) {

}

protected void onDestroy()

{

super.onDestroy();

if (mediaPlayer != null)

{

mediaPlayer.release();

mediaPlayer = null;

//关闭cursor

// VideoList.cursor.close();

//关闭数据库

// VideoList.db.close();

//改变线程循环条件

f = false;

handler.removeMessages(0x11);

popuWindow.dismiss();

}

}

public void onClick(View v) {

if(v==play){

//如果正在播放

if (buttonFlag) {

play.setImageResource(R.drawable.pause_1);

mediaPlayer.pause();

buttonFlag = false;

}else{

play.setImageResource(R.drawable.play_1);

mediaPlayer.start();

buttonFlag = true;

}

handler.removeMessages(0x11);

handler.sendEmptyMessageDelayed(0x11, hint);

}

if (v == fastPlay) {

int i = mediaPlayer.getCurrentPosition()+5000;

mediaPlayer.seekTo(i);

seekbar.setProgress(i);

handler.removeMessages(0x11);

handler.sendEmptyMessageDelayed(0x11, hint);

}

if (v == fastBack) {

int i = mediaPlayer.getCurrentPosition()-5000;

mediaPlayer.seekTo(i);

seekbar.setProgress(i);

handler.removeMessages(0x11);

handler.sendEmptyMessageDelayed(0x11, hint);

}

}

Handler handler = new Handler(){

public void handleMessage(android.os.Message msg) {

if (msg.what == 0x11) {

if(popuWindow.isShowing()&&f){

popuWindow.dismiss();

popFlag = false;

}

////启动后设置layout隐藏

/* layout_control.setVisibility(View.INVISIBLE);

layout_prograss.setVisibility(View.INVISIBLE);*/

}

if (msg.what == 0x12) {

if(mediaPlayer!=null){

num = mediaPlayer.getCurrentPosition();

}

seekbar.setProgress(num);

// 为时分秒赋值

num = num/1000;

int minute = num/60;

int hour = minute/60;

int second = num%60;

minute = minute%60;

/* if (mediaPlayer!=null) {

seekbar.setProgress(mediaPlayer.getCurrentPosition());

}*/

showTime.setText(String.format("播放进度:"+"%02d:%02d:%02d", hour,minute,second));

// handler.sendEmptyMessage(0x12);

}

if (msg.what == 0x14) {

if (VideoList.share.getString("playstyle","顺序播放").equals("单曲循环")) {

//释放播放的视频

mediaPlayer.release();

//游标移动到点击ListView位置

// VideoList.cursor.moveToPosition(VideoList.position);

//在数据库中取出ListView点击的路径

VideoList.path = VideoList.cursor.getString(1);

//播放视频

playVideo();

}

if (VideoList.share.getString("playstyle", "顺序播放").equals("顺序播放")) { //释放当前的MediaPlayer

mediaPlayer.release();

//自加

position ++;

if (position==VideoList.videoList.getCount()) {

position = 0;

}

//游标向下移动

VideoList.cursor.moveToPosition(position);

//取出移动后的视频路径

VideoList.path = VideoList.cursor.getString(1);

//播放视频

playVideo();

}

if (VideoList.share.getString("playstyle", "顺序播放").equals("随机播放")) { //释放播放的视频

mediaPlayer.release();

int r = random.nextInt(VideoList.videoList.getCount()-1);

VideoList.cursor.moveToPosition(r);

//在数据库中取出ListView点击的路径

VideoList.path = VideoList.cursor.getString(1);

//播放视频

playVideo();

}

}

};

};

class MyThread extends Thread{

@Override

public void run() {

handler.sendEmptyMessageDelayed(0x11, hint);

// if (mePlayer.getDuration()+"".equals("0") ) {

while (f) {

try {

sleep(1000);

handler.sendEmptyMessage(0x12);

}catch (InterruptedException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

// }

}

}

class countClear extends Thread{

@Override

public void run() {

try {

sleep(1000);

//睡一秒后count清0

count = 0;

} catch (InterruptedException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

}

@Override

public void surfaceDestroyed(SurfaceHolder holder) { // TODO Auto-generated method stub

}

@Override

public void onBufferingUpdate(MediaPlayer mp, int percent) { // TODO Auto-generated method stub

}

@Override

public boolean onDown(MotionEvent e) {

// TODO Auto-generated method stub

return false;

}

@Override

public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {

// TODO Auto-generated method stub

return false;

}

@Override

public void onLongPress(MotionEvent e) {

// TODO Auto-generated method stub

}

@Override

public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {

// TODO Auto-generated method stub

return false;

}

@Override

public void onShowPress(MotionEvent e) {

// TODO Auto-generated method stub

}

@Override

public boolean onSingleTapUp(MotionEvent e) {

// TODO Auto-generated method stub

return false;

}

}

配置文件:

Video.xml文件

android:id="@+id/videoback"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:orientation="vertical" >

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:background="#00000000"

android:id="@+id/distant"/>

android:id="@+id/surfaceview_1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_marginTop="300px"

android:layout_gravity="center_horizontal" />

Popuwindow.xml配置文件

android:id="@+id/videoback"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:orientation="vertical" >

android:id="@+id/layout_prograss"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_gravity="bottom"

android:orientation="vertical" >

android:id="@+id/seekbar"

android:layout_width="match_parent"

android:layout_height="8px"

android:progressDrawable="@drawable/seekbar"

android:thumb="@drawable/seekbutton"

android:progress="0" />

android:id="@+id/showtime"

android:layout_width="match_parent"

android:layout_height="wrap_content"

/>

android:id="@+id/alltime"

android:layout_width="match_parent"

android:layout_height="wrap_content"

/>

android:id="@+id/sound"

android:layout_height="8px"

android:progressDrawable="@drawable/seekbar"

android:thumb="@drawable/seekbutton"

android:progress="50" />

android:id="@+id/showsound"

android:layout_width="match_parent"

android:layout_height="wrap_content"

/>

android:id="@+id/layout_control"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_gravity="bottom"

android:orientation="horizontal" >

android:id="@+id/fastback"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_weight="1"

android:background="#00000000"

android:scaleType="fitCenter"

android:src="@drawable/stepback" />

android:id="@+id/video_bu_bofang"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_weight="1"

android:background="#00000000"

android:scaleType="fitCenter"

android:src="@drawable/play_1" />

android:id="@+id/fastplay"

android:layout_width="wrap_content"

android:layout_weight="1"

android:background="#00000000"

android:scaleType="fitCenter"

android:src="@drawable/stepfor" />

java视频播放器源代码

import java.awt.*; import java.io.*; import java.util.*; import javax.media.*; import javax.media.format.*; import javax.swing.*; public class VideoPlayer implements ControllerListener { Vector audioCapDevList = null; Vector videoCapDevList = null; CaptureDeviceInfo audioCapDevInfo = null; CaptureDeviceInfo videoCapDevInfo = null; MediaLocator audioCapDevLoc = null; MediaLocator videoCapDevLoc = null; Player audioPlayer; Player videoPlayer; public void initAudioCapDevLoc() { //这里可以填写其它的音频编码格式,具体请看AudioFormat类 audioCapDevList = CaptureDeviceManager.getDeviceList(new AudioFormat( AudioFormat.LINEAR)); if ((audioCapDevList.size() > 0)) { //或许有几个CaptureDevice,这里取第一个 audioCapDevInfo = (CaptureDeviceInfo) audioCapDevList.elementAt(0); audioCapDevLoc = audioCapDevInfo.getLocator(); } else { System.out.println("找不到音频采集设备"); System.exit(0); } } public void initVideoCapDevLoc() { //这里可以填写其它的编码视频格式,具体请看VideoFormat类 videoCapDevList = CaptureDeviceManager.getDeviceList(new VideoFormat( VideoFormat.YUV)); if ((videoCapDevList.size() > 0)) {

基于Android的多功能视频播放器的系统设计

文档编号:基于Android的多功能视频播放器 系统设计说明书 目录 1引言 4 1.1目的 4 1.2适用范围 4 2系统架构 5 2.1硬件架构 5 2.2软件架构 9 3完整功能结构图 11 4系统数据库设计 11 4.1 E-R图设计 11 4.2字段设计 11 4.2.1本地视频文件记录表 11

4.2.2历史播放文件表 12 4.2.3 收藏文件表 12 5视频播放器部署图 13 6 系统需求 13 6.1系统界面需求 13 6.2系统性能需求 13 6.1系统开发环境需求 14 7视频播放器流程图 14 1引言 1.1目的 本文档是多通道同步数字记录仪升级换代项目的系统设计文档。从系统的高层角度对系统的硬件架构、软件架构、网络架构、系统部署、系统运行方式进行设计,为下一步各个模块的详细设计提供系统级的视图。 1.2适用范围 本文用于描述多通道同步数字记录仪升级换代项目的系统设计,给出系统的主要架构与配置项,对相关运行、数据、用户接口、容错与复用和重要模块进行分

析,作为项目后续详细设计与开发实现的依据。本说明书的阅读对象为:跟我们同龄的有一定基础的大学生,以及相关的项目开发人员等等。 2系统架构 2.1硬件架构 2.1.1 JDK安装 JDK是Java语言的原创者推出的原始开发环境。采用JDK开发Java程序能够很快理解程序中各部分代码之间的关系,有利于理解Java面向对象的设计思想。在Windows上安装JDK非常简单,访问Oracle官方网站下载页面,网址为,也可从其他网站下载。下载完成后,双击运行JDK安装程序并根据提示设定环境变量。 2.1.2 Android SDK安装以及系统设置 下载好SDK包后,将zip文件解压缩至合适的地方。在下文中,默认SDK安装目录为$SDK_ROOT 。 ● Linux下,打开文件~/.bash_profile或者~/.bashrc,找到设定PATH环境变量的一行,将$SDK_ROOT/tools的完整路径加入其中。如果没有找到设定PATH 变量的行,可以自己添加一行: export PATH=${PATH}:<$SDK_ROOT/tools的完全路径> ● Mac下,在home目录中找到文件.bash_profile,和Linux的一样处理。如果还没有在机器上设定这个文件,可以创建一个.bash_profile文件。 ● Windows下,右键点击【我的电脑】,选择【属性】,在【高级】页中,点击【环境变量】按键,在弹出的对话框中双击“系统变量”中的变量“Path”,将$SDK/tools的完全路径加入其中。

各视频格式播放代码

1。avi格式 代码片断如下: <object id="video" width="400" height="200" border="0" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA"> <param name="ShowDisplay" value="0"> <param name="ShowControls" value="1"> <param name="AutoStart" value="1"> <param name="AutoRewind" value="0"> <param name="PlayCount" value="0"> <param name="Appearance value="0 value="""> <param name="BorderStyle value="0 value="""> <param name="MovieWindowHeight" value="240"> <param name="MovieWindowWidth" value="320"> <param name="FileName" value="/Mbar。avi"> <embed width="400" height="200" border="0" showdisplay="0" showc autostart="1" autorewind="0" playcount="0" moviewindowheight="240" moviewindowwidth="320" filename="/Mbar。avi" src="Mbar。avi"> </embed> </object> 2。mpg格式 代码片断如下: <object classid="clsid:05589FA1-C356-11CE-BF01-00AA0055595A" id="ActiveMovie1" width="239" height="250">

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

音乐播放器程序源代码及注释: #include #define uchar unsigned char #define uint unsigned int sbit 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};//花样1 uchar code huayang2[]={0x7f,0xfe,0xbf,0xfd,0xdf,0xfb,0xef,0xf7, 0xef,0xfb,0xdf,0xfd,0xbf,0xfe};//花样2 uchar code huayang3[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,0x01,0x0, 0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff}; char code huayang4[]={ 0x55,0xaa,0xcc,0x33,0x99,0x66,0x0f,0xf0}; uchar count1;//花样标志 uchar count2;//歌曲标志 uchar timeh,timel,i; //编程规则:字节高位是简谱,低位是持续时间, //代表多少个十六分音符 //1-7代表中央C调,8-E代表高八度,0代表停顿

Java实现视频网站的视频上传及视频播放功能

视频网站中提供的在线视频播放功能,播放的都是FLV格式的文件,它是Flash动画文件,可通过Flash 制作的播放器来播放该文件.项目中用制作的播放器. 多媒体视频处理工具FFmpeg有非常强大的功能包括视频采集功能、视频格式转换、视频抓图、给视频加水印等。?? ffmpeg视频采集功能非常强大,不仅可以采集视频采集卡或USB摄像头的图像,还可以进行屏幕录制,同时还支持以RTP方式将视频流传送给支持RTSP的流媒体服务器,支持直播应用。 1.能支持的格式 ffmpeg能解析的格式:(asx,asf,mpg,wmv,3gp,mp4,mov,avi,flv等) 2.不能支持的格式 对ffmpeg无法解析的文件格式(wmv9,rm,rmvb等),可以先用别的工具(mencoder)转换为avi(ffmpeg 能解析的)格式. 实例是将上传视频转码为flv格式,该格式ffmpeg支持,所以我们实例中需要ffmpeg视频处理工具. 数据库 实例所需要的数据库脚本 drop database if exists db_mediaplayer;create database db_mediaplayer;use db_mediaplayer; create table tb_media( id int not null primary key auto_increment comment '主键' , title varchar(50) not null comment '视频名称' , src varchar(200) not null comment '视频存放地址' , picture varchar(200) not null comment '视频截图' , descript varchar(400) comment '视频描述' , uptime varchar(40) comment '上传时间' );

java简单媒体播放器源码.

//程序所用到的各种程序包 import java.awt.BorderLayout; import java.awt.CheckboxMenuItem; import java.awt.Color; import https://www.360docs.net/doc/b116990016.html,ponent; import java.awt.Container; import java.awt.FileDialog; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Menu; import java.awt.MenuBar; import java.awt.MenuItem; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent;

import javax.media.ControllerClosedEvent; import javax.media.ControllerEvent; import javax.media.ControllerListener; import javax.media.EndOfMediaEvent; import javax.media.GainControl; import javax.media.Manager; import javax.media.MediaLocator; import javax.media.NoPlayerException; import javax.media.Player; import javax.media.PrefetchCompleteEvent; import javax.media.RealizeCompleteEvent; import javax.media.Time; import javax.swing.JFrame; //本程序对应的类; class MediaPlayer extends JFrame implements ActionListener, ControllerListener, ItemListener { //MediaPlayer类的变量成员的声明; //JMF提供的播放器对象;

Android视频上传与播放的设计与实现

毕业设计 题目:基于Android的校园信息移动平台的 设计

摘要 随着智能手机的快速普及,智能手机操作系统市场风生水起。为了让智能手机能够随时随地地查询互联网所提供的服务,一种高效的方法就是将应用系统的功能拓展到手机终端上,让手机能够通过移动网络以及互联网访问相关资源信息。因此,智能手机应用软件及其需要的服务将有广阔的发展前景。 本课题为其设计一个基于Android在线学习系统,为用户提供一个可以用于在线播放视频、视频评论和收藏的APP应用,丰富用户娱乐生活,提高生活情趣。 本论文首先介绍系统的开发背景和意义,接着详细介绍系统设计以及实现的过程,最后介绍了系统测试和本软件的测试用例以及总结了本次毕业设计整个过程。 关键词:Android 、智能系统、在线课堂、手机软件

ABSTRACT With the rapid proliferation of smart phones, smart phone operating system market burgeoned. In order to make smart phones can check the Internet anytime, anywhere service provided, an efficient method is to expand the application system functions to the mobile terminal, allowing the phone to access information via the mobile network resources and the Internet. Therefore, smart phone applications and services they need to have broad prospects for development. Based on this study to design an Android video player that can be used to provide users with an online video, video reviews and collections of APP applications, rich user entertainment life, improve zest for life. This paper introduces the background and significance of the development of the system, followed by detailed system design and implementation process, and finally introduced the system testing and test this software and summarizes the whole process of this graduation project. Keywords: Android, intelligent systems, player, mobile phone software

在网页中插入视频播放代码全集

在网页中插入视频播放代码全集.txt 2.mpg格式 代码片断如下:

视频播放器通用代码

ASP视频播放器通用代码 1.avi格式 2.mpg格式

基于Android的视频通话系统的设计与实现毕业设计论文

东北大学毕业设计(论文)摘要基于Android的视频通话系统的设计与实现 摘要 近年来,智能手机操作系统发展迅速,尤其是Android系统的迅猛发展已经将全球智能手机市场引领到了非常火爆的状态。随着手机社交网络、手机多媒体通信和手机游戏等应用程序不断被开发出来,各种基于智能手机操作系统的应用程序正在逐渐影响和改变人们的生活方式。实时视频流技术在可视电话、远程教育、视频点播等方面得到了广泛的应用。 本文设计并实现的基于Android的视频通话系统采用C/S架构,包括PC和手机两个客户端。手机端使用Android2.3操作系统。本系统共包含四个子系统:PC端接收子系统、发送子系统,Android端接收子系统、发送子系统。接收子系统实现数据接收、转码和呈现,发送子系统现实数据采集、编码压缩和数据发送。PC端基于JMF框架来实现,Android端使用Android Camera类及其相关类来实现。本文对国内外视频通话的研究情况以及今后的发展前景,对实现视频通话所涉及到的协议和相关技术进行了分析,在此基础上提出了一种可行的网络视频通话设计方案,并通过需求分析、详细设计、编码实现、单元测试以及集成测试等过程完成了本系统的设计与实现。 本系统实现了跨平台视频通话,使PC与Android之间的视频通话成为了可能,可以起到丰富人们日常生活交流和娱乐方式的作用。 关键词:Android,视频通话,JMF,PC,RTP/RTCP

Design and Implementation of an Android-Based Video Calling System Abstract In recent years, the rapid development of smart phone operating system, especially Android system, has led the global smart phone market into explosion state. With some application such as mobile social networking, mobile media communications and mobile games being continually developed, a variety of application on smart phone operation systems are increasingly affecting and changing people’s lifestyles. The real-time video streams technology is used widely in such aspects as videophone, distance education and video on demand. The system based on android uses c/s architecture. It includes two clients. One is on the Windows system, the other one is on the Android 2.3 system. There are four subsystems. Each of clients has a send subsystem and a receiver subsystem. The main function of the receiver subsystem is to receiver data from internet and decodes that data. After that, it will display that data as soon as possible. The main function of the send subsystem is to collect data from camera and then encodes the data. After that, the data will be sanded to the Internet. On the PC client, we use the JMF framework. One the Android client, we use Android API. This paper firstly introduces the research condition of the video call and development tendency. It analysis some technologies about the video calling system and comes up with a feasible plan. It introduces the video calling system about requirement analysis, detailed design, realize and testing. This system achieves the cross-platform video calling. It becomes possible to make video calling between PC and Android and will enrich the people’s communication and entertainment in their daily lives. Key words: Android, video call, JMF, PC, RTP/RTCP

Java音乐播放器源代码即结果显示

简单的音乐播放器一、程序代码: import java.io.File; import java.awt.BorderLayout; import java.awt.Button; import java.awt.Color; import java.awt.FileDialog; import java.awt.Frame; import java.awt.GridLayout; import https://www.360docs.net/doc/b116990016.html,bel; import java.awt.List; import java.awt.Menu; import java.awt.MenuBar; import java.awt.MenuItem; import java.awt.MenuShortcut; import java.awt.Panel; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.DataLine; import javax.sound.sampled.SourceDataLine; public class Example extends Frame { private static final long serialVersionUID = 1L; boolean isStop = true;// 控制播放线程 boolean hasStop = true;// 播放线程状态

基于Android的视频播放器的设计与实现

基于Android的视频播放器的设计与实现

基于Android的视频播放器的设计与实现 中文摘要 如今,随着基于Android操作系统的智能手机的广泛应用,视频播放器已成为智能手机的一个必不可少的程序,广大用户迫切需要一个贴近用户、方便用户、个性化的视频播放器。因此,设计一个基于android手机的多功能播放器,具有重要的实际意义。 本次毕业设计主要使用JDK + Eclipse + Android-SDK-Windows工具进行开发,使用的编程语言是Java语言。该程序主要由4个不同Activity来实现,每个Activity实现相应的功能模块,能够有效满足Android手机用户在视频播放中的常见需求。 本论文详细介绍了播放器程序的设计思路、设计方案、系统结构和项目工程结构,对系统的可行性与需求性进行了详细的分析,阐述了系统各个模块功能的设计与实现。对程序主要的Activity都进行了详细的介绍和分析,包括对其使用的布局文件的具体介绍,以及各个控件的作用。在最后进行了程序测试,对每一个实现的模块功能都做了测试,并且记录了大量截图用来展示测试结果,以观察程序应有的功能是否正常运行,以及发现程序中可能存在的问题。所开发的程序界面比较友好,操作相对容易,达到设计要求。 关键词:安卓;视频播放;Activity;Mediaplayer

The Design and Implementation of Video Player Based on Android ABSTRACT Now, with the wide application of smart phone based on the Android operating system, video player has become the essential application of smart phone. Most of consumers urgently require a personalized video player which is close to user and facilitate user. Therefore, the design of a multifunctional player based on android mobile phones has an important practical significance. The project design is developed by using JDK, Eclipse, and Android-SDK-Windows tools. The programming language is Java. The program consists of four different Activities and each Activity achieves the corresponding functional modules which can effectively satisfy the common requirements for playing video on Android mobile phones. This paper introduced the design ideas, design scheme, system architecture and project engineering structures of video player. The feasibility and requirements of system were analyzed in detail. The system function and each module were explained. The main Activity of the program are described and analyzed in detail including the using layout file, as well as the role of each control. Finally, I made the test for the program including the functions of each implemented modules. In order to observe whether the program should function properly and find the problems that may exist in the program, many screenshots were saved to demonstrate the test results. The developed program has a friendly interface and can be operated relatively easy, which has achieved the design requirement. KEY WORDS: Android; Video Play; Activity; Mediaplayer

几种在网页中播放FLV视频文件的代码

几种在网页中播放FLV视频文件的代码(附FLV播放器) 方法一、js嵌入 直接copy下面代码,修改其中红色部分,即:swf_width、swf_height、texts、files 参数引用 其中: 群英传WEB版宣传视频是标题。 https://www.360docs.net/doc/b116990016.html,/flv/qyzweb.flv是FLV文件地址。 https://www.360docs.net/doc/b116990016.html,/flv/flvplayer.swf 是FLV文件播放器地址(如果你不会制作,可下载别人的然后上传到自己的空间再调用)。

安卓音乐播放器开发,含源代码

基于an droid平台的音乐播放器开发 实验报告 学生姓名:_______ 温从林 _________________ 学号: ___________________________________ 班级:计自1201 _____________ 第一章引言 1.1项目背景 当今社会的生活节奏越来越快,人们对手机的要求也越来越高,由于手机市场发展迅速,使得手机操作系统也出现了不同各类,现在的市场上主要有三个手机操作系统,Win dowsmobile,symbia n,以及谷歌的An droid操作系统,其中占有开放源代码优势的An droid系统有最大的发展前景。那么能否在手机上拥有自己编写的个性音乐播放器呢?能的,谷歌An droid系统就能做到。本文的音乐播放器就是基于谷歌An droid手机平台的播放器。 An droid :是谷歌于2007年公布的开放式源代码手机系统,它的开放性就优于其它封闭式的手机系统,因此,任何人都可能根据自己的喜好将手机系统中的所有功能重新编写。这使得越来越多的人关注这个操作系统。本次作品音乐播放器就是基于An droid平台的。 1.2编写目的 现今社会生活紧张,而欣赏音乐是其中最好的舒缓压力的方式之一,本项目的目的是开发一个可以播放主流音乐文件格式的播放器,本设计实现的主要功能是播放Mp3 Wav多种格式的音乐文件,并且能够控制播放,暂停,停止,播放列等基本播放控制功能,界面简明,操作简单。

本项目是一款基于An droid手机平台的音乐播放器,使An droid手机拥有个性的 多媒体播放器,使手机显得更生动灵活化,与人们更为接近,让手机主人随时随地处于音乐视频的旋律之中。使人们的生活更加多样化。也使设计者更加熟练An droid的技术和其它在市场上的特点。 1.3开发环境 Eclipse、An droid SDK 320 第二章系统需求分析 2.1功能需求(用例图分析) 根据项目的目标,我们可获得项目系统的基本需求,以下从不同角度来描述系统的需求,并且使用用例图来描述,系统的功能需求,我们分成四部分来概括,即播放器的基本控制需要,播放列表管理需求,播放器友好性需求和播放器扩展卡需求。以下分别描述: 2.1.1播放器的用例图 假设安装了音乐播放器的用户是系统的主要设计对象,其拥有以下操作, 启动软件、播放音乐、暂停播放、停止播放、退出软件,其用例图如下 图2.1 播放器基本用例图 2.1.2用例分析

相关文档
最新文档