clipbucket/upload/player/CB_video_js/cb_video_js.html
2017-03-22 13:11:00 +05:00

278 lines
8.7 KiB
HTML
Executable file

<!-- Following is the code for cb ultimate invideo ads settings -->
{$tcomments_params = ['function'=>'get_ultimate_ads']}
{$current_ad = get_my_function($tcomments_params)}
{if !empty($current_ad)}
{$play_ad = true}
{/if}
<!-- End -->
<!-- This code is added for timecomments plugin-->
{$tcomments_params = ['function'=>'get_timeCommnets','videoid'=>$vdata.videoid]}
{$Comments_allowed = $myquery->is_commentable($vdata,'v') }
{$timecomments = get_my_function($tcomments_params)}
<!-- End -->
<!-- This code is added for instance manager Interactive ads plugin-->
{$v_editor_params = ['function'=>'get_video_editor']}
{$video_editor_enabled = get_my_function($v_editor_params)}
<!-- End -->
{$svg_manager_params = ['function'=>'get_svg_manager']}
{$svg_manager = get_my_function($svg_manager_params)}
{if $svg_manager}
{$svg_manager}
{/if}
<!-- This code is added for instance manager Interactive ads plugin intances-->
{if !$video_editor_enabled }
{$intance_params = ['function'=>'get_slot','videoid'=>$vdata.videoid]}
{$active_instances = get_my_function($intance_params)}
{if is_array($active_instances)}
{$active_instances = json_encode($active_instances)}
{/if}
{/if}
<!-- End -->
<!-- This code is added for Related Videos carousel plugin-->
{foreach $videos as $video}
{$related['imageSrc'] = get_thumb($video,1,FALSE,FALSE,TRUE,FALSE,'168x105')}
{$related['url'] = video_link($video)}
{$related['title'] = $video.title|truncate:30}
{$related_videos[] = $related}
{/foreach}
{$related_videos = json_encode($related_videos)}
<!-- End -->
<link rel="stylesheet" href="{$cb_vjs_player_url}/css/video-js.min.css">
<link href="{$cb_vjs_player_url}/css/cb_vjs_plugin.css" rel="stylesheet">
<link href="{$cb_vjs_player_url}/css/videojs.ads.css" rel="stylesheet">
<link href="{$cb_vjs_player_url}/css/videojs.ima.css" rel="stylesheet">
<link href="{$cb_vjs_player_url}/css/cb_vjs_resolution.css" rel="stylesheet">
<link href="{$cb_vjs_player_url}/css/videojs-chromecast.css" rel="stylesheet">
<link href="{$cb_vjs_player_url}/css/videojs.thumbnails.css" rel="stylesheet">
{if $development_mode}
<script src="{$cb_vjs_player_url}/js/video-js.js"></script>
{else}
<script src="{$cb_vjs_player_url}/js/video-js.min.js"></script>
{/if}
<script src="{$cb_vjs_player_url}/js/cb_vjs_custom.js"></script>
<script src="{$cb_vjs_player_url}/js/cb_vjs_plugin.js"></script>
<script src="{$cb_vjs_player_url}/js/cb_vjs_resolution.js"></script>
{if $cb_timecomments_plugin == 'installed'}
<script src="{$cb_vjs_player_url}/js/timecomments.js"></script>
{/if}
{if $play_ad == true}
<script src="//imasdk.googleapis.com/js/sdkloader/ima3.js"></script>
{/if}
{if $video_editor_enabled}
<script type="text/javascript" src="{$cb_ia_ads_url}/assets/js/instance_manager.js"></script>
{/if}
{if $active_instances && !$video_editor_enabled}
<script type="text/javascript" src="{$cb_ia_ads_url}/assets/js/interactive.js"></script>
{/if}
<script src="{$cb_vjs_player_url}/js/videojs.ads.js"></script>
<script src="{$cb_vjs_player_url}/js/videojs.ima.js"></script>
<script src="{$cb_vjs_player_url}/js/cb_ultimate_ads.js"></script>
<script src="{$cb_vjs_player_url}/js/videojs.relatedCarousel.js"></script>
<script src="{$cb_vjs_player_url}/js/iphone-inline-video.browser.js"></script>
<script src="http://www.gstatic.com/cv/js/sender/v1/cast_sender.js"></script>
<script src="{$cb_vjs_player_url}/js/videojs-chromecast.js"></script>
<script src="{$cb_vjs_player_url}/js/videojs.thumbnails.js"></script>
{$default_quality = get_cbvjs_quality_type($video_files)}
<video playsinline id="cb_video_js_{$vdata.videoid}" class="video-js vjs-default-skin" height="{$height}" width="{$width}" poster="{getThumb vdetails=$vdata size=768x432}" >
{foreach $video_files as $file}
{$quality = get_cbvjs_quality($file)}
{if $flv_vid == true}
<source src='{$file}' type="video/x-flv" />
{else}
<source src='{$file}' type="video/mp4" label="{strtoupper($quality)}" res="{$quality}" />
{/if}
{/foreach}
{ANCHOR place="play_def_sub"}
<p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>
</video>
<script type="text/javascript">
var vid_id = "{$vdata.videoid}";
var videotitle = "{$vdata.title|escape_quotes}";
var uploader = "{$vdata.username}";
var branding_logo = "{$cb_logo}";
var product_link = "{$player_config.player_logo_url}";
var show_logo = true;
var autoplay = "{$player_config.autoplay}";
var default_res = "{$default_quality}";
if (autoplay == 'no'){
autoplay = false;
}else{
autoplay = true;
}
//player settings
var cb_player_setup = {
plugins : { },
"techOrder" : ['html5', 'flash'],
"controls": true,
"autoplay": autoplay,
"preload": "auto",
};
var cb_timecomments_plugin = "{$cb_timecomments_plugin}"; // timecomments settings
if (cb_timecomments_plugin){
var user_id = "{userid()}";
var username = "{username()}";
var user_profile = "{$userquery->avatar('','m',userid())}";
var allow_comments = "{$Comments_allowed}";
}
var play_ad = "{$play_ad}"; // Ad settings starts to pass on to player
if (play_ad){
var ad_code = "{$current_ad.ad_tag}";
var ad_id = "{$current_ad.ad_id}";
}
var related_videos = '{$related_videos}'; // Related videos plugin settings
var slot_id = "{$smarty.get.slot_id}";
related_videos_active= true;
var video_editor_enabled = "{$video_editor_enabled}"; // Interactive Ads plugin settings
var i_instances = '{$active_instances}';
//Setting CallBack
var cb_vjs_callback = function(){
var cb_vjs = this;
//Calling Custom videoJs Elements Plugin
var el_options = {
logo : {
branding_logo : branding_logo,
product_link : product_link,
show_logo : true
},
header : {
uploader : uploader,
videotitle : videotitle,
videoid : vid_id
}
}
cb_vjs.cb_vjs_elements(el_options);
//Calling Resolution switcher plugin
var res_options = {
default : default_res,
dynamicLabel : false
}
cb_vjs.videoJsResolutionSwitcher(res_options);
var stateCheck = setInterval(function(){
if (document.readyState === 'complete') {
clearInterval(stateCheck);
var cbVjsMenuBtn = document.querySelector('.vjs-resolution-button');
if (cbVjsMenuBtn){
var cbVjsMenu = cbVjsMenuBtn.children[0];
var cbVjsMenuContent = cbVjsMenu.children[0];
var cbVjsMenuContentRes = cbVjsMenuContent.children;
for (var i = 0; i < cbVjsMenuContentRes.length; i++ ){
cbVjsMenuContent.insertBefore(cbVjsMenuContentRes[i],cbVjsMenuContent.firstChild);
}
}
}
},100);
//Calling Ima Ads plugin
if (play_ad){
var ad_options = {
ad_id: ad_id,
ad_code: ad_code,
autoplay: autoplay
};
cb_vjs.cb_ultimate_ads(ad_options);
}
//Calling TimeComments switcher plugin
if ( cb_timecomments_plugin == 'installed' && typeof cb_timecomments_plugin != 'undefined'){
var timecomments = '{$timecomments}';
var comments_options = {
comments : timecomments,
dummy : false,
videoid : vid_id,
userid : user_id,
userprofile : user_profile,
username : username,
allowComments : allow_comments,
forceShow : true
}
cb_vjs.timecomments(comments_options);
if (typeof timecomments != 'undefined' && timecomments != ''){
console.log("Initialized Time Comments");
}else{
console.log("Time Comments are empty.. /");
}
}
//Calling related Videos Plugin
if ( related_videos != "" && typeof related_videos != 'undefined' && related_videos_active &&
!video_editor_enabled ){
related_videos = JSON.parse(related_videos);
cb_vjs.relatedCarousel(related_videos);
}
//Calling instance manager plugin for backend
if ( video_editor_enabled && typeof video_editor_enabled != 'undefined'){
instance_manager_settings = {
slot_id : slot_id
}
cb_vjs.instanceManager(instance_manager_settings);
}
//Calling interactive ads plugin
if (i_instances){
i_instances = JSON.parse(i_instances);
i_instances_settings = {
enable : true,
dummy : false,
instances : i_instances,
}
cb_vjs.interactiveAds(i_instances_settings);
}
}
//Initializing
var cb_player = videojs('cb_video_js_'+vid_id, cb_player_setup , cb_vjs_callback);
$(document).ready(function() {
new_player_height(vid_id);
$(".video-js").on("contextmenu",function() {
return false;
});
});
$(window).resize(function(event) {
new_player_height(vid_id);
});
</script>
<style type="text/css">
.video-js {
width: 100%;
}
.video-js .vjs-tech {
height: 100% !important;
}
.editorpick .cb_video_js-dimensions{
width: 100% !important;
height: 100% !important;
}
</style>