Skip to content

Commit 3ad738e

Browse files
committed
Update to v1.1.2
1 parent 65bfc67 commit 3ad738e

File tree

9 files changed

+60
-9
lines changed

9 files changed

+60
-9
lines changed

assets/screenshot-3.png

37.4 KB
Loading

dist/dplayer.zip

115 KB
Binary file not shown.

dplayer-admin.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,26 @@ function plugin_options_menu() {
6767
"<input type='textbox' name='kblog_danmaku_token' id='kblog_danmaku_token' $danmaku_token>",
6868
'kblog_danmaku_token'
6969
);
70+
71+
$enable_hls = '';
72+
if ( get_option( 'kblog_enable_hls' ) ) {
73+
$enable_hls = 'checked="true"';
74+
}
75+
$this->admin_table_row( 'Enable hls.js',
76+
'Live Video (HTTP Live Streaming, M3U8 format) support',
77+
"<input type='checkbox' name='kblog_enable_hls' id='kblog_enable_hls' value='1' $enable_hls />",
78+
'kblog_enable_hls'
79+
);
80+
81+
$enable_flv = '';
82+
if ( get_option( 'kblog_enable_flv' ) ) {
83+
$enable_flv = 'checked="true"';
84+
}
85+
$this->admin_table_row( 'Enable flv.js',
86+
'FLV format support',
87+
"<input type='checkbox' name='kblog_enable_flv' id='kblog_enable_flv' value='1' $enable_flv />",
88+
'kblog_enable_flv'
89+
);
7090

7191
$this->table_foot();
7292
}
@@ -79,6 +99,9 @@ function admin_save() {
7999
if ( array_key_exists( 'kblog_danmaku_token', $_POST ) && isset( $_POST['kblog_danmaku_token'] ) ) { // input var okay
80100
update_option( 'kblog_danmaku_token', wp_unslash( $_POST['kblog_danmaku_token'] ) ); // input var okay
81101
}
102+
103+
update_option( 'kblog_enable_hls', array_key_exists( 'kblog_enable_hls', $_POST ) ); // input var okay
104+
update_option( 'kblog_enable_flv', array_key_exists( 'kblog_enable_flv', $_POST ) ); // input var okay
82105
}
83106

84107
function table_head() {

dplayer.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
* Plugin Name: DPlayer for WordPress
44
* Description: Wow, such a lovely HTML5 danmaku video player comes to WordPress
5-
* Version: 1.0.8
5+
* Version: 1.1.2
66
* Author: 0xBBC
77
* Author URI: https://blog.0xbbc.com/
88
* License: GPLv3
@@ -76,6 +76,7 @@ public static function dplayer_load($atts = [], $content = null, $tag = '') {
7676
if ($atts['screenshot']) $data['screenshot'] = ($atts['screenshot'] == 'true') ? true : false;
7777
if ($atts['hotkey']) $data['hotkey'] = ($atts['hotkey'] == 'true') ? true : false;
7878
if ($atts['preload']) $data['preload'] = (in_array($atts['preload'], array('auto', 'metadata', 'none')) == true) ? $atts['preload'] : 'metadata';
79+
if ($atts['bilibili']) $data['addition'] = array(get_option( 'kblog_danmaku_url', '' ).'bilibili?aid='.$atts['bilibili']);
7980

8081
$playerCode = '<div id="player'.$id.'" class="dplayer">';
8182
$playerCode .= "</div>\n";
@@ -105,7 +106,13 @@ public static function dplayer_settings_link( $links, $file ) {
105106

106107
public static function add_script() {
107108
if (!self::$add_script) {
108-
wp_enqueue_script( 'dplayer', plugins_url('js/DPlayer.min.js', __FILE__), false, '1.0.10', false );
109+
if ( get_option( 'kblog_enable_flv' ) ) {
110+
wp_enqueue_script( '0-dplayer-flv', plugins_url('js/plugin/flv.min.js', __FILE__), false, '1.1.2', false );
111+
}
112+
if ( get_option( 'kblog_enable_hls' ) ) {
113+
wp_enqueue_script( '0-dplayer-hls', plugins_url('js/plugin/hls.min.js', __FILE__), false, '1.1.2', false );
114+
}
115+
wp_enqueue_script( 'dplayer', plugins_url('js/DPlayer.min.js', __FILE__), false, '1.1.2', false );
109116
wp_enqueue_script( 'init-dplayer', plugins_url('js/init-dplayer.js', __FILE__), false, '1.0.0', false );
110117
self::$add_script = true;
111118
}

js/DPlayer.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/DPlayer.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/plugin/flv.min.js

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/plugin/hls.min.js

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

readme.txt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ Contributors: 0xbbc
33
Tags: video, player, shortcode
44
Requires at least: 3.0.1
55
Tested up to: 4.6.1
6-
Stable tag: 1.0.8
7-
License: GPLv2 or later
8-
License URI: http://www.gnu.org/licenses/gpl-2.0.html
6+
Stable tag: 1.1.2
7+
License: GPLv3
8+
License URI: http://www.gnu.org/licenses/gpl-3.0.html
99

1010
== Description ==
1111

@@ -22,6 +22,7 @@ Parameter 'screenshot', enable screenshot?. Optional and default false.
2222
Parameter 'loop', enable loop?. Optional and default false.
2323
Parameter 'preload', preload mode, 'auto', 'metatdata' or 'none'. Optional and default metadata.
2424
Parameter 'hotkey', enable builtin hotkey? including left, right and Space. Optional and default true.
25+
Parameter 'bilibili', bilibili视频AV号. Additional danmaku from bilibili
2526
Parameter 'danmu', should DPlayer load danmaku. Default false and it's optional.
2627

2728
== Installation ==
@@ -38,6 +39,14 @@ Parameter 'danmu', should DPlayer load danmaku. Default false and it's optional.
3839

3940
== Changelog ==
4041

42+
= 1.1.2 =
43+
* Update DPlayer to version 1.1.2
44+
* Add support for hls.min.js
45+
* Add support for flv.min.js
46+
47+
= 1.0.9 =
48+
* Update DPlayer to version 1.1.1
49+
4150
= 1.0.8 =
4251
* Add settings page for API URL and token
4352

0 commit comments

Comments
 (0)