Skip to content

Commit 1a94450

Browse files
committed
Fixed bug
Fixed a bug that wrongly assgined default value
1 parent 5210834 commit 1a94450

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Parameter 'pic' is the poster of the video. And it's optional.
2323
Parameter 'autoplay', as the name suggests, if it is true, then once the video is prepared, it starts to play . Default false and it is optional also.
2424
Parameter 'screenshot', enable screenshot?. Optional and default false.
2525
Parameter 'loop', enable loop?. Optional and default false.
26+
Parameter 'preload', preload mode, 'auto', 'metatdata' or 'none'. Optional and default metadata.
2627
Parameter 'hotkey', enable builtin hotkey? including left, right and Space. Optional and default true.
2728
Parameter 'danmu', should DPlayer load danmaku. Default false and it's optional.
2829

dist/dplayer.zip

147 Bytes
Binary file not shown.

dplayer.php

Lines changed: 8 additions & 6 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.2
5+
* Version: 1.0.3
66
* Author: 0xBBC
77
* Author URI: https://blog.0xbbc.com/
88
*
@@ -86,13 +86,15 @@ public static function dplayer_load($atts = [], $content = null, $tag = '') {
8686
'theme' => $theme,
8787
'loop' => false,
8888
'screenshot' => false,
89-
'hotkey' => true
89+
'hotkey' => true,
90+
'preload' => 'metadata'
9091
);
9192

92-
$data['autoplay'] = ($atts['autoplay'] == 'true') ? true : false;
93-
$data['loop'] = ($atts['loop'] == 'true') ? true : false;
94-
$data['screenshot'] = ($atts['screenshot'] == 'true') ? true : false;
95-
$data['hotkey'] = ($atts['hotkey'] == 'true') ? true : false;
93+
if ($atts['autoplay']) $data['autoplay'] = ($atts['autoplay'] == 'true') ? true : false;
94+
if ($atts['loop']) $data['loop'] = ($atts['loop'] == 'true') ? true : false;
95+
if ($atts['screenshot']) $data['screenshot'] = ($atts['screenshot'] == 'true') ? true : false;
96+
if ($atts['hotkey']) $data['hotkey'] = ($atts['hotkey'] == 'true') ? true : false;
97+
if ($atts['preload']) $data['preload'] = (in_array($atts['preload'], array('auto', 'metadata', 'none')) == true) ? $atts['preload'] : 'metadata';
9698

9799
$playerCode = '<div id="player'.$id.'" class="dplayer">';
98100
$playerCode .= "</div>\n";

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Parameter 'pic' is the poster of the video. And it's optional.
2222
Parameter 'autoplay', as the name suggests, if it is true, then once the video is prepared, it starts to play . Default false and it is optional also.
2323
Parameter 'screenshot', enable screenshot?. Optional and default false.
2424
Parameter 'loop', enable loop?. Optional and default false.
25+
Parameter 'preload', preload mode, 'auto', 'metatdata' or 'none'. Optional and default metadata.
2526
Parameter 'hotkey', enable builtin hotkey? including left, right and Space. Optional and default true.
2627
Parameter 'danmu', should DPlayer load danmaku. Default false and it's optional.
2728

0 commit comments

Comments
 (0)