Add woocommerce Chaturbate tokens payment gateway

parent e110388b
......@@ -70,8 +70,13 @@ if(!class_exists('SH_Shortcodes')) {
extract( shortcode_atts(array(
"url" => '',
"posters" => '',
"autoplay" => false
), $attr));
return "<div class='sexhls_video'>" . sh_hls_player($url, $posters) . "</div>";
ob_start();
sh_hls_player($url, $posters, $autoplay);
$player = ob_get_contents();
ob_end_clean();
return "<div class='sexhls_video'>" . $player . "</div>";
}
public static function video_xr($attr, $cont)
......@@ -80,7 +85,11 @@ if(!class_exists('SH_Shortcodes')) {
"url" => '',
"posters" => '',
), $attr));
return "<div class='sexvideo_videojs'>" . sh_xr_player($url, $posters) . "</div>";
ob_start();
sh_xr_player($url, $posters);
$player = ob_get_contents();
ob_end_clean();
return "<div class='sexvideo_videojs'>" . $player . "</div>";
}
public static function xframe_bypass($attr, $cont)
......
......@@ -29,13 +29,13 @@ if(!class_exists('SH_VideoPlayer')) {
class SH_VideoPlayer
{
public static function addPlayer($player_type='hls', $vurl='', $posters="", $projection='180_LR')
public static function addPlayer($player_type='hls', $vurl='', $posters="", $projection='180_LR', $autoplay=false)
{
$html = false;
switch($player_type)
{
case 'hls':
$html = sh_get_template("videoplayer/hls.php", array('vurl' => $vurl, 'posters' => $posters ));
$html = sh_get_template("videoplayer/hls.php", array('vurl' => $vurl, 'posters' => $posters, 'autoplay' => strval($autoplay) ));
break;
case 'xr':
......
This diff is collapsed.
......@@ -28,7 +28,9 @@ function sh_get_template($tmpl, $args=array())
{
foreach($args as $var => $data) $$var = $data;
if(file_exists(SH_PLUGIN_DIR_PATH . 'templates/' . $tmpl))
return include_once SH_PLUGIN_DIR_PATH . 'templates/' . $tmpl;
{
return include SH_PLUGIN_DIR_PATH . 'templates/' . $tmpl;
}
return false;
}
......@@ -75,9 +77,9 @@ function sh_genpass_register_form()
}
function sh_hls_player($video_url, $posters='')
function sh_hls_player($video_url, $posters='', $autoplay=false)
{
SH_VideoPlayer::addPlayer('hls', $video_url, $posters);
SH_VideoPlayer::addPlayer('hls', $video_url, $posters, '', $autoplay);
}
function sh_xr_player($video_url, $posters='', $projection='180_LR')
......
......@@ -20,7 +20,7 @@
//var vtag = document.getElementById('vtag');
function SexHLSPlayer(url, vuid){
function SexHLSPlayer(url, vuid, autoplay=false){
var vtag = document.getElementById(vuid);
if(Hls.isSupported()) {
vtag.volume = 0.3;
......@@ -28,10 +28,14 @@ function SexHLSPlayer(url, vuid){
var m3u8Url = decodeURIComponent(url)
hls.loadSource(m3u8Url);
hls.attachMedia(vtag);
hls.on(Hls.Events.MANIFEST_PARSED,function() {
hls.on(Hls.Events.MANIFEST_PARSED,function(autoplay) {
hls.autoLevelEnabled = true;
//hls.loadLevel = 4;
hls.startLoad();
if(autoplay==true) {
vtag.mute = true;
}
vtag.play(); // XXX Autoplay doesn't work apparently atm
});
//document.title = url
......
......@@ -27,7 +27,7 @@ $uid = uniqid('sexhls_');
<video id="<?php echo $uid; ?>" style="width: 100%; height: 100%;" controls poster="<?php echo $posters; ?>"></video>
<script language="javascript">
$(window).on('load', function() {
SexHLSPlayer('<?php echo $vurl; ?>', '<?php echo $uid; ?>');
SexHLSPlayer('<?php echo $vurl; ?>', '<?php echo $uid; ?>', <?php echo $autoplay; ?>);
$('#<?php echo $uid; ?>').on('click', function(){this.paused?this.play():this.pause();});
Mousetrap(document.getElementById('<?php echo $uid; ?>')).bind('space', function(e, combo) { SexHLSplayPause('<?php echo $uid; ?>'); });
Mousetrap(document.getElementById('<?php echo $uid; ?>')).bind('up', function(e, combo) { SexHLSvolumeUp('<?php echo $uid; ?>'); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment