链接加密

  抱歉,这篇文章有英文版

The encryption option in the PRO version of PlayerJS Builder helps to hide links in the source code of the page. It does not protect against the ability to get the link manually through the browser’s developer tools, but it helps against parsers and other automatic ways to steal content.

In the builder you can download a PHP script file that encrypts links with keys. The keys are specified in the encoder file and in the player settings:

Keys can be changed independently at any time, it is not necessary to specify all of them.

Wordpress

How to add encryption to your website

Given the variety of CMS and options for integrating the player, there is no clear instructions. You can ask for help from the developer who integrated your player, if it possible. Or try to do it yourself.

Encryption code must be added to your server script, which generates the player code. For example, you specified the x/x/x, y/y/y and z/z/z keys in the builder (these combinations of characters should not be found in the links that you encrypt and contain quotation marks).

$string = "http://site.com/video.mp4";
include_once("playerjs_base64.php");
$GLOBALS['pjsBase64Keys'] = array('x/x/x','y/y/y','z/z/z','','');
$result = pjsBase64Encrypt($string);

$string — original link, $result — encoded link. The result of the encryption should be passed to the player instead of the clear link. For example:

print("var player = new Playerjs({id:'player',file:'$result'});");

Please note that in this example the file playerjs_base64.php is in the same folder as the script being edited.

In the archive with the script there is a file test.php with an example of using the encoder.

How to add encryption on Wordpress

If you are using a plugin for Wordpress version 2.8 and higher, then edit the playerjs_base64.php encoder file, specifying the keys from the builder there:

$GLOBALS['pjsBase64Keys'] = array('key1','key2','','','');

and save it to the folder wp-content/plugins/playerjs/admin. To disable encryption, simply delete the file from the folder or rename it.

How to encrypt all variables

You can encrypt all variables at once (works from version 8.34). You need to encrypt the object (the names of the variables must be in quotes).

$string ='{"id":"player","file":"//site.com/video.mp4"}';
$result = pjsBase64Encrypt($string);
var player = new Playerjs("$result");

Links are still visible in the developer tools

Links in the video or audio tags are visible through the developer tools in the manual mode and cannot be hidden - this is debugging tool. But these tags are created dynamically and are not visible in the source code of the page, which is automatically parsed.


20.0.0
2024 © PlayerJS

登录

登录

免费注册

注册
注册即表示您同意服务条款
登录(如果您有帐户)

恢复密码

恢复
忘记电子邮件?联系我们