1. ホーム
  2. Web プログラミング
  3. ウェブプレーヤー

オンラインFLVプレーヤーの実装方法

2022-01-18 08:55:56
プログラムコード
コピーコード コードは以下の通りです。

/{br
wmode="transparent" data="flvplayer.swf">



"flvplayer.swf" will automatically find "video.flv" in the same directory to play. You can also add the URL of the FLV file after "flvplayer.swf" to play it. The method is as follows.
Copy code The code is as follows:

/{br
wmode="transparent data="flvplayer.swf?file=movies/holiday.flv">




"file=movies/holiday.flv" is the parameter, you can use relative or absolute address.
Other parameters are described as follows.
If you don't want the movie to play automatically when loading, you can use the "autostart" parameter
Example
Program code

wmode="transparent" data="flvplayer.swf?autostart=false">



Multiple parameters can be mixed, list of valid parameters.
Procedure code
file (address of FLV file)
autostart (whether to allow autoplay, "true" or "false")
image (preview image when not playing, only JPEG format is supported)
repeat (whether to repeat the image)
clicktext (the text displayed at the beginning, default is "click to play")
---------------------------------------------------------------
Here is the 3.12 version http://www.cgfans.net/bbs/Medias/2007/10/jw_flv_player.zip This is version 3.12
This document contains the installation and configuration of JW MP3 Player, JW FLVPlayer, JW Media Player, JW Image Rotator
method {This document contains the installation and configuration of JW Image Rotator.
JW PLAYERS 3.12 Documentation
1, Installation (embedded in your site)
2, Parameters (configuration)
Basic parameters
Color parameters
Interface parameters
Playback parameters
Interactive parameters
3, Playlist
4, Custom
5, Support
Quick configuration, can run configuration wizard
1, Install
After downloading, you can get an example of a swf that, when opened with a text or HTML editor, you can find the swf in a short paragraph
javascript embedded on the page. The Javascript is swfobject.js written by Geoff Stearns, which solves the problem of Flash needing to excite
live trouble. When copying swf to your site, don't forget to copy swfobject.js along with it. And in the page of
Head with the following code
Program Code

在swfobject.js的帮助下你可以方便的设置swf的路径,宽度,高度,背景颜色和所需要的Flash播放器的版本,也可以通过它设置一组参数来配置swf。当页面加载的时候,javascript会根据id来替换页面中的节点。
程序代码

Get Flash to see this player.



在你不能使用javascript的情况下(比如你的bsp不支持,如myspace),你可以使用"embed"的方式来插入swf。
需要注意的是 swf可以不在该服务器上,但是如果你需要用xml的播放列表可能会有问题,因为xml必须和swf在同一个服务器上,否则会因为安全问题被组织。mp3,jpg,flv可以不在该服务器上。
程序代码

type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"
flashvars="file=http://www.myfileserver.com/folder/test.flv&displayheight=300" />
2,参数
这些参数可以配置被嵌入到html中的播放器的行为和外观。如果使用swfobject.js,可以用addVariable()方法来配置,如果使用的embed方式,可以通过定义"flashvars"属性来配置变量,注意用"&"符号分割这些变量。
被*号标注的同样适用于 JW Image Rotator
基本变量
displayheight(number):显示区域的高度.控制区域最小高度是20px,当该值大于或等于swf的高度时,播放列表会自动隐藏,否这会显示。
file*(url):要播放文件的地址。 支持单文件播放(MP3/FLV/RTMP/JPG/SWF/PNG/GIF),也支持播放列表。JW Image Rotator只支持列表
height*(number):设置swf的高度,当使用embed方式插入的时候,在embed的属性里已经设置了。但是有时候(特别是使用IE的时候)高度会变的不确定,影响了布局,这时候需要通过该参数设置下,该值的单位是px
image(url):当你播放mp3,flv的时候,你可以通过该值设置一个预览图作为专辑封面,支持 JPG/SWF/PNG/GIF file. 你也可以在播放列表中对每一项进行设置。
shownavigation*(true,false):该参数仅被JW Image Rotator支持。用来显示或隐藏图片导航。
transition* (fade,bgfade,blocks,bubbles,circles,fluids,lines,random,slowfade): 该参数仅被JW Image Rotator支持。用来设置图片替换的效果。 设置为"random" 将随机的设置效果.默认值为 "fade".
width*(number):设置swf的宽度,其他同height;
颜色变量
backcolor*(color):设置播放器的背景颜色。JW Media Player等默认为 0xFFFFFF (白色) JW Image Rotator默认为 0x000000 (黑色).
fontcolor*(color):设置文字和按钮的颜色。JW Media Player等默认为 0x000000 (黑色) JW Image Rotator默认为 0xFFFFFF (白色).
lightcolor*(color):设置被被激活状态的颜色。JW Media Player等默认为 0x000000 (黑色) JW Image Rotator默认为 0xCC0000 (红色).
界面参数
autoscroll(true,false):当播放列表过长的时候,默认会自动显示滚动条。当该值设置为'true'的时候,会自动根据鼠标滚动播放列表。
displaywidth(number of pixes):设置显示区域的宽度,当设置的比较小的时候,播放列表会显示在显示区域的右侧而不是底部。
kenburns* (true,false): 用以实现在运动的时候实现kb效果(Ken Burns effect),注意,当图比较大,而且网速比较快的时候,建议打开,否则关闭。建议设置transition为"slowfade"来配合。
largecontrols (true,false): 设置该值为true用来放大控制区域的按钮。建议为视力不好的用户打开
logo* (url): 设置一个图片用来作为右上角的水印,支持所有图片格式,支持通明图层的png效果最佳。
overstretch* (true,false,fit,none): 设置图片/影片在显示区域的缩放。"true"等比例拉伸用来符合显示区域。"false"仅拉伸合显示区域。"fit"全屏显示。"none"显示原始大小。JW Media Player等默认为"fit",JW Image Rotator默认为"false"
showdigits (true,false,total): 设置为"false"隐藏播放时间等信息用来节省控制区域的空间。设置为"total"用来显示全部时间。
showdownload (true,false):设置该值用来在控制区域显示下载按钮。链接到link所设置的地址。
showeq (true,false): 用来显示一个假的音频波动效果。当播放mp3的时候打设置该值可以得到很好的效果
showicons* (true,false): 用来显示或者隐藏显示区域中间的图片,JW Media Player等默认为true。JW Image Rotator默认为false;
showvolume (true,false): 用来设置是否显示音量控制按钮
thumbsinplaylist (true,false): 设置列表中是否显示预览图
播放参数
autostart (true,false,muted): 设置为ture,页面加载完后会自动播放。设置为muted,会在静音模式下自动播放,并且显示区域中间有静音图标。
bufferlength (number): 设置flv的缓存时间。默认为3秒
repeat* (true,false,list): 默认为flase,从当前播放位置播放到列表尾部后停止。设置为list会播放列表中所有的项目,设置为true会循环播放。
rotatetime* (number): 设置图片的显示时间。JW Media Player等默认为10秒,JW Image Rotator默认为5秒
shuffle* (true,false): 设置为false顺序播放,设置为true无序播
smoothing (true,false): 设置为false关闭视频平滑处理,推荐设置true用以得到更好效果。但对于大屏幕或者配置低的机器设置false是有好处的
start* (second): 在使用RTMP 或 HTTP 流媒体的时候(非常规的flv/mp3),使用该变量准确的定位开始位置。该参数设置在XSPE格式的列表中以便准且的设置文件的章节。
volume* (number): 设置音量,默认为80.
互动参数
audio* (url):用这个参数来添加一个mp3文件作为单独的音频,可以作为图片的背景音乐解说等。
bwfile (url):用以带宽检测的文件的地址,可以放一个图片,或者rtmp流媒体。可以在右键菜单中查看到贷款数值。
bwstreams (comma-separated list of bitrates):
和bwfile配合使用,根据带宽值来选择不同的文件。如:你要播放video.flv并且设置该项的值为100,250,500,1000,当播放器发现带宽为349kbps的时候,将会播放video_250.flv。所以他有一套有效的命名设置,他将会自动切换,哪怕是在采用播放列表的情况下。
callback (url):设置这个参数为服务端程序(php/asp)地址用来回传数据。在每个项播放和停止的时候会发送数据到服务器,以便在服务器端保存播放统计。
captions (url): 设置该值用以载入一个文本格式的文本作为字幕。播放器至支持SMIL格式和DVD的SRT格式的字幕。如果你的flv文件内置字体你可以设置该值为"captionate".如果你有多频道字幕,可以设置这个值为"captionate0", "captionate3"等。可以在列表中设置每一个项的值。
enablejs* (true,false): set to true to turn on support for javascript. Only supported for online use. javascript can control playback, load media, and get detailed information about the currently playing item.
fsbuttonlink (url): if the user has a flashplayer version higher than (9.0.28) the player will automatically display a full screen button. By setting this value, you can link to another page for full-screen display. The server program can set the file to be played.
id (string): Unique identifier for the player. It will be passed back to the server side.
javascriptid* (string): If you have more than one player on your page, you can set this parameter to give each player a different id, so that it can be easily controlled with javascript. He will be passed back to the getUpdate() event.
link (url): Use this parameter to set a presentable version or force the user to download the current item via this address. This value can be set for each item in the playlist.
linkfromdisplay* (true,false): Set the page to be visited when the display is clicked. The default is to play/pause when the display is clicked.
linktarget* (frame): set the link target, "_self" opens in the current page." _blank" opens in a new page.
streamscript (url): Set this parameter to be compatible with 'pseudo-streaming' FLV files.
type (mp3,flv,rtmp,jpg,png,gif,swf,rbs,3gp,mp4,m4v): the player will determine the type based on the last three characters of the file name. This will no longer work when you are using server-side languages for redirection. So you can set this parameter to tell the player the file type. You can also set it for each item in the playlist. If the player can't find the file type it will be recognized as a playlist.
useaudio (true,false): Set to false to change to mute.
usecaptions (true,false): set to false to hide subtitles.
usefullscreen (true,false):If you don't want to use flashplayer9's fullscreen mode. You can set the "fsbuttonlink" parameter to replace the fullscreen button event.
usekeys (true,false): set to "false" to cancel keyboard operations (SPACE,UP,DOWN,LEFT,RIGHT)
Note: You must do a character shift for ? =& for character shifting. → %3F, = → %3D, & → %26. Your "file" variable for getplaylist.php?id=123 must be set to getplaylist.php%3Fid%3D123.
Playlist
When there is only one item in the playlist, the player will play it in single file playback mode. The player distinguishes between single file and playlist files based on the file name. If you load a file with the file name test.mp3, the player will play the mp3 in single file play mode, because the extension is mp3. If you use a dynamic script to load a single file like
The player supports three common playlist formats to ensure versatility: XSPF, RSS, and ATOM.
Generic tags for XSPF/RSS/ATOM lists supported by the player.
Tables

*Image Rotator only supports the first 'audio' item in the playlist, being used as background music to play. The player will play all music items.
** The "category" element can be used to support ads. You can set this value to "preroll", "postroll" or "overlay".
Use the value of a single item in the "link" playlist as the ad address.
*** The "start" element is only supported by the XSPF playlist format. This element is used to set the start position of the streaming file (HTTP or RTMP) in seconds.
The "location" element in the **** XSPF list format can use the "meta" element to specify the file format if it does not contain a common extension (such as "mp3" or "flv"). (e.g.
Customize
I've had multiple people ask me to create some customizable versions. Many of their requests can actually already be accomplished by setting parameters. I made an online configuration wizard to simply configure these parameters. I don't have the energy to meet everyone's requirements. But there will be a lot of interesting additional features in the next version.
If you are familiar with the actionscript scripting language, you can modify the program to add features yourself.
The player will recently finish adding the configuration and playlist variables when it is instantiated, and then it will enter the MCV lifecycle. The configuration and list manager (feeder) is always active during the MCV lifecycle.
All methods of the two objects marked in red can be called via javascript.
It is possible to reference the player in a separate flash application. Just copy the image from the downloaded flv file to your flv and make sure to copy the downloaded com directory to your flv file that contains all the scripts. Then you can access the variables at the position of the first frame of the timeline. Be careful to set the height and width variables, otherwise the player will stretch and distort according to your dimensions.
As
Procedure Code
// Set the flashvars (booleans and numbers should also be quoted)
var width = "320";
var height = "240";
var file = "my_video.flv";
var autostart = "true";
// Start the player
/
var mpl = new com.jeroenwijering.players.MediaPlayer(this.player);
/MediaPlayer(this.player);
Additionally, I have made the controller a public object, so you can control the mediaplayer with the sendEvent() function from anywhere in your flash site (the schematic above has a list of all sendEvent() options). Let's continue the small script above:
{
I've created a public controller object for the player, so you can control the player from anywhere in your program by using sendEvent(), e.g.
Program code
mpl.controller.sendEvent("volume",50);
mpl.controller.sendEvent("playpause");
Support
List of Frequently Asked Questions
1. If you are using ie and the layout is wrong, the size is probably not set properly, you can use the variables "width" and "height" to force it. {You can use the variables "width" and "height" to force them.
2. Note that the security mechanism of flash and javascript will affect your local testing. It also affects your files when they are on different servers, you can try to put them on the same server.
3. The fullscreen feature is only available in flash player version 9.028.0 or above, if you use swfobject to embed your player, you can use his auto-update feature. Note that setting "allowfullscreen" to true
4. If your progress bar is not moving, or you have a problem with the length of your video. Then maybe your flv doesn't set the correct metadata. you can use a small tool www.buraks.com/flvmdi/.
/
The two versions are slightly different, see the instructions inside for details
Official download link:http://www.jeroenwijering.com/upload/jw_flv_player.zip