The use of video player plug-in JWPlayer

Brief introduction

  JW Media Player is an open source Flash video, audio and picture player used on the page,
support Sliverlight playback, support for H.264 (.mp4, .mov, .f4v), FLV (.flv),
the 3GPP (.3gp , .3g2), OGG Theora (.ogv ) and WebM (.webm) video formats, MP3
(.mp3), AAC (.aac, .m4a), OGG Vorbis (.ogg) and WAV (.wav) audio,
while also support swf and pictures (gif, jpg, png) and YouTube video formats.
Official website address: https://www.jwplayer.com/learn-more/
enter the mailbox to download, and core files jwplayer.js player.swf.

use

JS introduced

<script src="js/plugins/jwplayer/jwplayer.js"></script>

use

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* html*/
<div id="container"></div>
<input type="button" class="player-play" value="播放" />
<input type="button" class="player-stop" value="停止" />
<input type="button" class="player-status" value="取得状态" />
<input type="Button" class = "Current-Player" value = "seconds currently played" />
< INPUT type = "Button" class = "GOTO-Player" value = "30 Seconds Go" />
< INPUT type = "Button" class = "Player-length" value = "video duration (seconds)" />

/* js*/
<script type="text/javascript">
var thePlayer;
$(function() {
ThePlayer = JWplayer ( 'Container' ) .setUp ({
the Flashplayer: 'JS / plugins / JWplayer / player.swf' ,
File: 'JS / plugins / JWplayer / video.mp4' ,
aspectRatio: "16:. 9" , big Box   video player plug-in JWPlayer use AN>
of the type: "MP4" , // play the file type (optional)
title: "click to play" , // title (optional)
width: "85%" ,
height: "80 % " ,
Dock: to false
}); // Play Pause $ ( '.player-Play'


).click(function() {
if (thePlayer.getState() != 'PLAYING') {
thePlayer.play(true);
this.value = '暂停';
} else {
thePlayer.play(false);
this.value = '播放';
}
});

//停止
$('.player-stop').click(function() {ThePlayer.stop ();}); // get status $ ( '.player-Status' ) .click ( function (


) { Var State thePlayer.getState = (); var MSG; Switch (State) { Case 'BUFFERING' : MSG = 'Loading ...' ; BREAK ; Case 'PLAYING' : MSG = 'Now Playing' ; BREAK ; Case 'PAUSED ' : MSG = ' pause ' ; BREAK ; Case ' the IDLE ' : MSG = ' stop ' ; BREAK ; }
















Alert (MSG);
}); // Get the play progress $ ( '.player-Current' ) .click ( function (


) { alert(thePlayer.getPosition()); });

// Go to the specified player location
$ ( '.player-GOTO' ) .click ( function () { IF ! (ThePlayer.getState () = 'PLAYING' ) { // If the current is not playing, the player first starts thePlayer.play (); } thePlayer.seek ( 30 ); // start playing (in the specified position : sec) }); // Get video length $ ( '.player-length' ) .click ( function (







) { alert(thePlayer.getDuration()); });
});
</script>

Guess you like

Origin www.cnblogs.com/lijianming180/p/12041361.html