Ver Mensaje Individual
  #4 (permalink)  
Antiguo 16/10/2019, 12:56
Avatar de ceaped
ceaped
 
Fecha de Ingreso: febrero-2004
Mensajes: 2.185
Antigüedad: 20 años, 2 meses
Puntos: 9
Respuesta: Galería swipebox no me funciona con YouTube ni en local

Hola ArturoGallegos
Si, es una alternativa si no logro que me cargue los videos .mp4.
Te cuento que yo no utilizo "wordpress" es un .HTML si no que vi que en el foro de ayuda alguien daba una respuesta a ese problema así:

Cita:
This work for me:
in swipebox/jquery.swipebox.min.js

add src.match into "isVideo:function(src)"

src.match(/mp4|wmv|wma|ogv|ogg|flv/)
this new var into "getVideo:function(url)"

var normalvideoUrl=url.match(/uploads\/([a-zA-Z0-9\-_/.*]+)/)
and a new " else if(normalvideoUrl){ }" [after if(youtubeUrl) and else if(vimeoUrl) ]

else if(normalvideoUrl){ iframe= '<video class="wp-video-shortcode" width="560" height="315" preload="metadata" autoplay="autoplay" controls="controls"><source type="video/mp4" src="/wp-content/uploads/'+normalvideoUrl[1]+'"></video>'}
replace "/uploads" and "/wp-content/" (wordpress default) for each case
autoplay="autoplay" is optional

in css file add ",#swipebox-slider .slide .swipebox-video-container .swipebox-video video" in line "#swipebox-slider .slide .swipebox-video-container .swipebox-video iframe"
por: carlosjosedesign

Yo lo que hice fue agregar:

Código Javascript:
Ver original
  1. isVideo : function (src){
  2.  
  3.                 if( src ){
  4.                     if(
  5.                         src.match(/youtube\.com\/watch\?v=([a-zA-Z0-9\-_]+)/)
  6.                         || src.match(/vimeo\.com\/([0-9]*)/)
  7.                         || src.match('://(www.)?dailymotion\.com')
  8.                         || src.match(/mp4|wmv|wma|ogv|ogg|flv/)
  9.                     ){
  10.                         return true;
  11.                     }
  12.                    
  13.                     if (src.toLowerCase().indexOf( "swipeboxvideo=1" ) >= 0){
  14.  
  15.                         return true;
  16.                     }
  17.                 }
  18.  
  19.             },

Agregué este código:
|| src.match(/mp4|wmv|wma|ogv|ogg|flv/)

Código Javascript:
Ver original
  1. getVideo : function(url){
  2.                
  3. [COLOR="red"][B]var normalvideoUrl=url.match(/uploads\/([a-zA-Z0-9\-_/.*]+)/)[/B][/COLOR]
  4.                
  5.                 var success = false;
  6.                 if (url.match('://(www.)?youtube|youtu\.be')) {
  7.                     if (url.match('embed')) { youtube_id = url.split(/embed\//)[1].split('"')[0]; }
  8.                     else { youtube_id = url.split(/v\/|v=|youtu\.be\//)[1].split(/[?&]/)[0]; }
  9.                     v_id    = youtube_id;
  10.                     i_src = "http://www.youtube.com/embed/"+v_id+"?controls=1&color=white&showinfo=0&autoplay=1&hd=1&fs=1&rel=0";
  11.                     success = true;
  12.                 }
  13.                 else if (url.match('://(player.)?vimeo\.com')) {
  14.                     vimeo_Reg = /https?:\/\/(?:www\.)?vimeo.com\/(?:channels\/|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|)(\d+)(?:$|\/|\?)/;
  15.                     match = url.match(vimeo_Reg);
  16.                     v_id = match[3];
  17.                     i_src = "http://player.vimeo.com/video/"+v_id+"?title=0&byline=0&portrait=0&color=ffffff&autoplay=1";
  18.                     success = true;
  19.                 }
  20.                 else if (url.match('://(www.)?dailymotion\.com')) {
  21.                     m = url.match(/^.+dailymotion.com\/((video|hub)\/([^_]+))?[^#]*(#video=([^_&]+))?/);
  22.                     v_id = m ? m[5] || m[3] : null;
  23.                     i_src = "http://www.dailymotion.com/embed/video/"+v_id+"?autoplay=true&background=000000&foreground=ffffff&highlight=ffffff";
  24.                     success = true;
  25.                 }
  26.                 else if(normalvideoUrl){  iframe= '<video class="wp-video-shortcode" width="560" height="315" preload="metadata" autoplay="autoplay" controls="controls"><source type="video/mp4" src="/wp-content/uploads/'+normalvideoUrl[1]+'"></video>'}
  27.                 }
  28.                 if (success) {
  29.                     iframe = '<iframe width="560" height="315"  src="'+i_src+'" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
  30.                     return '<div class="swipebox-video-container" style="max-width:'+plugin.settings.videomaxWidth+'px"><div class="swipebox-video">'+iframe+'</div></div>';}
  31.                 },

Agregué este código:

else if(normalvideoUrl){ iframe= '<video class="wp-video-shortcode" width="560" height="315" preload="metadata" autoplay="autoplay" controls="controls"><source type="video/mp4" src="/wp-content/uploads/'+normalvideoUrl[1]+'"></video>'}
}


Pero igual no me funcionó.
¿Sí esta bien como agregué ese código?

Gracias por tu ayuda
__________________
Diseñador Gráfico publicitario

Última edición por ceaped; 16/10/2019 a las 13:00 Razón: Cambiar texto y corregirlo