JWplayer 用法及参数介绍(一)
JWPlayer的使用入门
这里使用JWPlayer,需要搭建网络环境(phpStudy)
JWPlayer官网http://www.longtailvideo.com/
JWPlayer下载页面http://www.longtailvideo.com/jw-player/download/
解压后,将jwplayer整个文件夹放到appserv/www目录下
- 新建html文件
<html>
<head>
<script src="/jwplayer/jwplayer.js"></script>
</head>
<body>
<div id='myplayer'></div> <script type='text/javascript'> jwplayer('myplayer').setup({ file: 'testfile/H264_640x480_AAC(LC).mp4', width: '640', height: '480' });
</script>
</body>
</html>
file参数根据自己实际情况进行修改
在浏览器中打开就可以观看了(直接打开无效,localhost打开)
如:http://127.0.0.1/jwplayer/test.html
2.利用jquery 加一些控制
jquery是一个javascript框架,是一个轻量级的js库,可以下载到本地。具体应用请google
<html>
<head>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script src="/jwplayer/jwplayer.js"></script>
</head>
<body>
<div id='myplayer'></div>
<input type="button" class="player-play" value="Play" />
<input type="button" class="player-stop" value="Stop" />
<input type="button" class="player-status" value="Status" />
<input type="button" class="player-position" value="TimeStamp" />
<input type="button" class="player-seek" value="Seek_15s" />
<input type="button" class="player-duration" value="Duration" />
<script type='text/javascript'>var thePlayer;thePlayer = jwplayer('myplayer').setup({ file: 'testfile/H264_640x480_AAC(LC).mp4', width: '640', height: '480',dock: false,repeat: true}); //Play Pause$('.player-play').click(function(){if(thePlayer.getState() != 'PLAYING'){thePlayer.play(true);this.value = 'Pause';}else {thePlayer.play(false);this.value = 'Play';}});//Stop$('.player-stop').click(function(){thePlayer.stop();});//Status$('.player-status').click(function(){var state = thePlayer.getState();var msg;switch(state){case 'BUFFRING':msg = 'Buffering';break;case 'PLAYING':msg = 'Playing';break;case 'PAUSED':msg = 'Pause';break;case 'IDLE':msg = 'Stop';break;}alert(msg);});//get current position$('.player-position').click(function() { alert(thePlayer.getPosition()); });//Seek$('.player-seek').click(function(){if(thePlayer.getState()!= 'PLAYING'){thePlayer.play();}thePlayer.seek(15);});//get duration$('.player-duration').click(function() {alert(thePlayer.getDuration());}); </script>
</body>
</html>
thePlayer.seek(15)这个我在chrome浏览器下测这个方法没有用,不知道是不是我自己的问题,没有找到解决的办法。
未完待续… …
JWplayer 用法及参数介绍(一)相关推荐
- DEDECMS中Showmsg的用法及参数介绍
DEDECMS中Showmsg函数是用来显示返回的提示信息以及跳转到相应页面,但是大部分新手并不知道怎么用,本文就着重来讲解下. 1.先看showmsg的格式: ShowMsg($msg,$gourl ...
- HDFS命令行客户端使用,命令行客户端支持的命令参数,常用命令参数介绍
3.HDFS的shell(命令行客户端)操作 3.1 HDFS命令行客户端使用 HDFS提供shell命令行客户端,使用方法如下: [toto@hadoop hadoop-2.8.0]$ hdfs d ...
- HDFS的简介及基本操作(常用的命令参数介绍)
目录 前言: 1.HDFS基本概念 2.HDFS基本操作 总结: 目录 前言: 总算有空来接着写大数据的学习笔记了,今天就把之前学过的HDFS的基础知识详细的介绍一下,如有哪点写的不足希望大家多多指教 ...
- vue3 内置组件keep-alive用法的全面介绍
vue3 内置组件keep-alive用法的全面介绍 基础用法 首先看一个反面例子 const app = Vue.createApp({template: `<button v-for=&qu ...
- x264参数介绍(帧类型和码率控制,分析和视频可用性信息)
鉴于x264的参数众多,各种参数的配合复杂,为了使用者方便,x264建议如无特别需要可使用preset和tune设置.这套开发者推荐的参数较为合理,可在此基础上在调整一些具体参数以符合自己需要,手动设 ...
- Apache中 RewriteCond 规则参数介绍 转
原文链接: http://blog.sina.com.cn/s/blog_545759110100h5g4.html Apache中 RewriteCond 规则参数介绍 转 (2010-01-04 ...
- mysql raiserror_sql server数据库中raiserror函数用法的详细介绍
sql server数据库中raiserror函数的用法 server数据库中raiserror的作用就和asp.NET中的throw new Exception一样,用于抛出一个异常或错误.这个错误 ...
- 网路摄像头技术参数介绍
网路摄像头技术参数介绍 星光级图像传感器 4MP (2592 × 1520) @30fps SmartH.265 / H.265+ / H.265 / SmartH.264 / H.264+ / H. ...
- GCC编译选项参数介绍
gcc和g++分别是gnu的c和c++编译器,下面是整理的常用编译选项参数: #(1). -x: 设定文件所使用的语言,使文件后缀名无效,如下,执行完后生成test.o gcc -c -x c++ t ...
最新文章
- 分布式文件系统KFS源码阅读与分析(四):RPC实现机制(KfsClient端)
- 怎么把html4换文件夹打不开,HTML4
- Spring学习(三)--Spring的IOC
- Android中SQLiteDatabase操作【附源码】
- 用Flash模拟小车
- android 清空数组缓存,Android数据持久化之读写SD卡中内容的方法详解
- java位图去重_Redis系列(3) Bloom/BitMap/Geo
- (23)Linux下Clion中搭建opencv环境
- Linux硬盘分区与文件系统---学习笔记
- 软考中级系统集成项目管理工程师视频教程
- nRF24L01模块——基于Arduino
- mac开启HiDPI
- java tic tac toe_确定Tic Tac Toe游戏的算法
- SSD固态硬盘:掉盘的四大类原因
- 【FCC前端教程】28关学会HTML与HTML5基础
- 复杂电路简化经典例题_复杂电路简化练习题
- 业务:品类和品类管理
- dc dc变换器的建模及matlab仿真,基于Matlab的AC/DC变换器的系统建模和仿真.pdf
- 网站自媒体伪原创文章生成器
- 0基础小白,怎么通过这5招玩转网络社群营销?