Add woocommerce Chaturbate tokens payment gateway

parent e110388b
...@@ -70,8 +70,13 @@ if(!class_exists('SH_Shortcodes')) { ...@@ -70,8 +70,13 @@ if(!class_exists('SH_Shortcodes')) {
extract( shortcode_atts(array( extract( shortcode_atts(array(
"url" => '', "url" => '',
"posters" => '', "posters" => '',
"autoplay" => false
), $attr)); ), $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) public static function video_xr($attr, $cont)
...@@ -80,7 +85,11 @@ if(!class_exists('SH_Shortcodes')) { ...@@ -80,7 +85,11 @@ if(!class_exists('SH_Shortcodes')) {
"url" => '', "url" => '',
"posters" => '', "posters" => '',
), $attr)); ), $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) public static function xframe_bypass($attr, $cont)
......
...@@ -29,13 +29,13 @@ if(!class_exists('SH_VideoPlayer')) { ...@@ -29,13 +29,13 @@ if(!class_exists('SH_VideoPlayer')) {
class 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; $html = false;
switch($player_type) switch($player_type)
{ {
case 'hls': 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; break;
case 'xr': case 'xr':
......
This diff is collapsed.
...@@ -28,7 +28,9 @@ function sh_get_template($tmpl, $args=array()) ...@@ -28,7 +28,9 @@ function sh_get_template($tmpl, $args=array())
{ {
foreach($args as $var => $data) $$var = $data; foreach($args as $var => $data) $$var = $data;
if(file_exists(SH_PLUGIN_DIR_PATH . 'templates/' . $tmpl)) 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; return false;
} }
...@@ -75,9 +77,9 @@ function sh_genpass_register_form() ...@@ -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') function sh_xr_player($video_url, $posters='', $projection='180_LR')
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
//var vtag = document.getElementById('vtag'); //var vtag = document.getElementById('vtag');
function SexHLSPlayer(url, vuid){ function SexHLSPlayer(url, vuid, autoplay=false){
var vtag = document.getElementById(vuid); var vtag = document.getElementById(vuid);
if(Hls.isSupported()) { if(Hls.isSupported()) {
vtag.volume = 0.3; vtag.volume = 0.3;
...@@ -28,10 +28,14 @@ function SexHLSPlayer(url, vuid){ ...@@ -28,10 +28,14 @@ function SexHLSPlayer(url, vuid){
var m3u8Url = decodeURIComponent(url) var m3u8Url = decodeURIComponent(url)
hls.loadSource(m3u8Url); hls.loadSource(m3u8Url);
hls.attachMedia(vtag); hls.attachMedia(vtag);
hls.on(Hls.Events.MANIFEST_PARSED,function() { hls.on(Hls.Events.MANIFEST_PARSED,function(autoplay) {
hls.autoLevelEnabled = true; hls.autoLevelEnabled = true;
//hls.loadLevel = 4; //hls.loadLevel = 4;
hls.startLoad(); hls.startLoad();
if(autoplay==true) {
vtag.mute = true;
}
vtag.play(); // XXX Autoplay doesn't work apparently atm vtag.play(); // XXX Autoplay doesn't work apparently atm
}); });
//document.title = url //document.title = url
......
...@@ -27,7 +27,7 @@ $uid = uniqid('sexhls_'); ...@@ -27,7 +27,7 @@ $uid = uniqid('sexhls_');
<video id="<?php echo $uid; ?>" style="width: 100%; height: 100%;" controls poster="<?php echo $posters; ?>"></video> <video id="<?php echo $uid; ?>" style="width: 100%; height: 100%;" controls poster="<?php echo $posters; ?>"></video>
<script language="javascript"> <script language="javascript">
$(window).on('load', function() { $(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();}); $('#<?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('space', function(e, combo) { SexHLSplayPause('<?php echo $uid; ?>'); });
Mousetrap(document.getElementById('<?php echo $uid; ?>')).bind('up', function(e, combo) { SexHLSvolumeUp('<?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