added custom video overlay player to avoid to load all the iframe systematicly
This commit is contained in:
@@ -289,15 +289,14 @@ function clameurs_field_default_field_instances() {
|
||||
'display' => array(
|
||||
'accueil' => array(
|
||||
'label' => 'hidden',
|
||||
'module' => 'video_embed_field_overlay',
|
||||
'module' => 'video_embed_field',
|
||||
'settings' => array(
|
||||
'description' => 1,
|
||||
'description_position' => 'bottom',
|
||||
'image_link' => 'source',
|
||||
'image_style' => 'video_thumb_docu',
|
||||
'overlay' => 'dom-window',
|
||||
'show_thumbnail' => 1,
|
||||
'video_style' => 'normal',
|
||||
),
|
||||
'type' => 'video_embed_field_overlay',
|
||||
'type' => 'video_embed_field_thumbnail',
|
||||
'weight' => 5,
|
||||
),
|
||||
'default' => array(
|
||||
@@ -457,15 +456,14 @@ function clameurs_field_default_field_instances() {
|
||||
'display' => array(
|
||||
'accueil' => array(
|
||||
'label' => 'hidden',
|
||||
'module' => 'video_embed_field_overlay',
|
||||
'module' => 'video_embed_field',
|
||||
'settings' => array(
|
||||
'description' => 1,
|
||||
'description_position' => 'bottom',
|
||||
'image_link' => 'source',
|
||||
'image_style' => 'video_thumb_episode',
|
||||
'overlay' => 'dom-window',
|
||||
'show_thumbnail' => 1,
|
||||
'video_style' => 'normal',
|
||||
),
|
||||
'type' => 'video_embed_field_overlay',
|
||||
'type' => 'video_embed_field_thumbnail',
|
||||
'weight' => 9,
|
||||
),
|
||||
'default' => array(
|
||||
@@ -893,15 +891,14 @@ function clameurs_field_default_field_instances() {
|
||||
'display' => array(
|
||||
'accueil' => array(
|
||||
'label' => 'hidden',
|
||||
'module' => 'video_embed_field_overlay',
|
||||
'module' => 'video_embed_field',
|
||||
'settings' => array(
|
||||
'description' => 1,
|
||||
'description_position' => 'bottom',
|
||||
'image_link' => 'source',
|
||||
'image_style' => 'video_thumb_themat',
|
||||
'overlay' => 'dom-window',
|
||||
'show_thumbnail' => 1,
|
||||
'video_style' => 'normal',
|
||||
),
|
||||
'type' => 'video_embed_field_overlay',
|
||||
'type' => 'video_embed_field_thumbnail',
|
||||
'weight' => 8,
|
||||
),
|
||||
'default' => array(
|
||||
|
||||
@@ -2,4 +2,5 @@ name = Clameurs Mod
|
||||
description = module for clameurs website
|
||||
core = 7.x
|
||||
package = "Clameurs"
|
||||
dependencies[] = panels
|
||||
dependencies[] = video_embed_field
|
||||
dependencies[] = domwindow
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
(function($) {
|
||||
|
||||
Clameurs = function(){
|
||||
|
||||
function init(){
|
||||
console.log("Clameurs");
|
||||
initVideoEvents();
|
||||
}
|
||||
|
||||
function initVideoEvents(){
|
||||
|
||||
$('.field-type-video-embed-field a').on('click', clickVideo);
|
||||
|
||||
};
|
||||
|
||||
function clickVideo(event){
|
||||
event.preventDefault();
|
||||
console.log('Click video', this);
|
||||
var vid_src = $(this).attr('href');
|
||||
console.log("vid_src", vid_src);
|
||||
getEmVidField(vid_src);
|
||||
return false;
|
||||
};
|
||||
|
||||
function getEmVidField(src){
|
||||
$.getJSON('clameursmod/getemvidfield',
|
||||
{'src':src},
|
||||
function(json){
|
||||
console.log("json loaded", json);
|
||||
displayVid(json)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
function displayVid(json){
|
||||
$('#videoframe').remove();
|
||||
|
||||
$vid = $('<div>')
|
||||
.attr('id', 'videoframe')
|
||||
.append(json.embed)
|
||||
.hide()
|
||||
.appendTo('body');
|
||||
|
||||
var iframe = $('iframe', $vid)[0];
|
||||
|
||||
var winwidth = $(window).width();
|
||||
var winheight = $(window).height();
|
||||
console.log('win :'+winwidth+' | '+winheight);
|
||||
|
||||
if (winwidth > winheight) {
|
||||
var w = winwidth*0.9;
|
||||
var h = w*(360/640);
|
||||
}else{
|
||||
var h = winheight*0.9;
|
||||
var w = h*(640/360);
|
||||
}
|
||||
|
||||
console.log('win :'+w+' | '+h);
|
||||
|
||||
$.openDOMWindow({
|
||||
loader:0,
|
||||
windowPadding:10,
|
||||
overlay:1,
|
||||
overlayColor:'#fff',
|
||||
overlayOpacity:'90',
|
||||
borderColor:'transparent',
|
||||
borderSize:'0',
|
||||
width:w,
|
||||
height:h,
|
||||
windowSourceID:"#videoframe"
|
||||
});
|
||||
}
|
||||
|
||||
init();
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
var clameurs = new Clameurs();
|
||||
});
|
||||
|
||||
|
||||
|
||||
})(jQuery);
|
||||
@@ -1,21 +1,43 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Implements hook_init().
|
||||
*/
|
||||
function clameursmod_init() {
|
||||
if ($path = libraries_get_path('jquery.domwindow')) {
|
||||
// Do something with the library, knowing the path, for instance:
|
||||
drupal_add_js($path . '/jquery.DOMWindow.js');
|
||||
}
|
||||
drupal_add_js(drupal_get_path('module', 'clameursmod').'/clameursmod.js');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_menu().
|
||||
*/
|
||||
// function clameursmod_menu() {
|
||||
// $items['accueil'] = array(
|
||||
// 'title' => '',
|
||||
// 'page callback' => '',
|
||||
// 'page arguments' => array(),
|
||||
// 'access arguments' => array(''),
|
||||
// 'type' => ,
|
||||
// 'file' => ,
|
||||
// );
|
||||
//
|
||||
// return $items;
|
||||
// }
|
||||
function clameursmod_menu() {
|
||||
|
||||
$items['clameursmod/getemvidfield'] = array(
|
||||
'page callback' => '_clameursmod_getemvidfield',
|
||||
'page arguments' => array(),
|
||||
'access callback' => TRUE,
|
||||
'type' => MENU_CALLBACK,
|
||||
// 'file' => ,
|
||||
);
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
function _clameursmod_getemvidfield(){
|
||||
$data = array();
|
||||
$data['test'] = "OK";
|
||||
$data['src'] = $_GET['src'];
|
||||
|
||||
$data['embed'] = theme('video_embed_field_embed_code', array('url'=>$data['src']));
|
||||
|
||||
drupal_json_output($data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_entity_info_alter().
|
||||
|
||||
Reference in New Issue
Block a user