-
AuthorPosts
-
April 26, 2018 at 9:49 am #947146
Hi,
i would like to add fullscreen to videos without editing the shortcode.js
aviaVideoAPI shoult work. but i got an error:Uncaught TypeError: Cannot read property 'indexOf' of undefined at $.AviaVideoAPI._getPlayerType (shortcodes.js?ver=4.2:943)
What is wrong in the script? Could you help me?
(function($) { $(document).ready(function($) { $('body').aviaVideoApi({features: ['playpause','progress','current','duration','tracks','volume','fullscreen']},$('.avia_video')); }); })(jQuery);
April 28, 2018 at 3:35 pm #948375Hey Innovie,
Could you please give us a link to your website, we need more context to be able to help you.
Best regards,
VictoriaApril 30, 2018 at 5:43 pm #949135This reply has been marked as private.May 3, 2018 at 5:36 am #950457Hi Innovie,
Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?
Best regards,
VictoriaMay 8, 2018 at 4:11 pm #953434This reply has been marked as private.May 10, 2018 at 1:14 pm #954531Hi,
This code should work. Just add it it in the functions.php file.
add_action('wp_footer', 'ava_custom_script'); function ava_custom_script(){ ?> <script type="text/javascript"> (function($) { $(document).ready(function() { //activate html5 video player if($.fn.avia_html5_activation && $.fn.mediaelementplayer) $(".avia_video, .avia_audio", container).avia_html5_activation({ratio:'16:9', features: ['playpause','progress','current','duration','tracks','volume', 'fullscreen']}); }); })(jQuery); </script> <?php }
It will override the theme’s default player options.
Best regards,
IsmaelAugust 30, 2018 at 9:58 am #1003466Thanks @Ismael!
If i re-initialize.avia-video
. i get two control bars: https://d.pr/i/K3BhXs
I only would like to add “fullscreen” feature for.avia-video
- This reply was modified 6 years, 2 months ago by Innovie.
August 31, 2018 at 5:25 am #1003916Hi,
Thanks for the update.
I can reproduce the issue on my end. Please replace the code with this one.
add_action('wp_footer', 'ava_custom_script_reload_video'); function ava_custom_script_reload_video(){ ?> <script type="text/javascript"> (function($) { var isMobile = false; if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) && 'ontouchstart' in document.documentElement) { isMobile = true; } else { isMobile = false; } $(window).on('load', function() { // ------------------------------------------------------------------------------------------- // html 5 videos // ------------------------------------------------------------------------------------------- $.fn.avia_html5_activation_mod = function(options) { var defaults = { ratio: '16:9' }; var options = $.extend(defaults, options); // if(isMobile) return; this.each(function() { var fv = $(this), id_to_apply = '#' + fv.attr('id'), posterImg = fv.attr('poster'); fv.mediaelementplayer({ // if the <video width> is not specified, this is the default defaultVideoWidth: 480, // if the <video height> is not specified, this is the default defaultVideoHeight: 270, // if set, overrides <video width> videoWidth: -1, // if set, overrides <video height> videoHeight: -1, // width of audio player audioWidth: 400, // height of audio player audioHeight: 30, // initial volume when the player starts startVolume: 0.8, // useful for <audio> player loops loop: false, // enables Flash and Silverlight to resize to content size enableAutosize: false, // the order of controls you want on the control bar (and other plugins below) features: ['playpause','progress','current','duration','tracks','volume', 'fullscreen'], // Hide controls when playing and mouse is not over the video alwaysShowControls: false, // force iPad's native controls iPadUseNativeControls: false, // force iPhone's native controls iPhoneUseNativeControls: false, // force Android's native controls AndroidUseNativeControls: false, // forces the hour marker (##:00:00) alwaysShowHours: false, // show framecount in timecode (##:00:00:00) showTimecodeFrameCount: false, // used when showTimecodeFrameCount is set to true framesPerSecond: 25, // turns keyboard support on and off for this instance enableKeyboard: true, // when this player starts, it will pause other players pauseOtherPlayers: false, poster: posterImg, success: function (mediaElement, domObject, instance) { //make the medialement instance accesible by storing it. usually not necessary but safari has problems since wp version 4.9 $.AviaVideoAPI.players[ fv.attr('id').replace(/_html5/,'') ] = instance; setTimeout(function() { if (mediaElement.pluginType == 'flash') { mediaElement.addEventListener('canplay', function() { fv.trigger('av-mediajs-loaded'); }, false); } else { fv.trigger('av-mediajs-loaded').addClass('av-mediajs-loaded'); } mediaElement.addEventListener('ended', function() { fv.trigger('av-mediajs-ended'); }, false); },10); }, // fires when a problem is detected error: function () { }, // array of keyboard commands keyActions: [] }); }); } //activate html5 video player if($.fn.avia_html5_activation_mod && $.fn.mediaelementplayer) { $('.avia-video, .avia-audio', 'body').each(function() { var container = $(this); var video = container.find('.avia_video'); container.empty(); video.clone().appendTo(container).addClass('reloaded'); container.find('.reloaded').avia_html5_activation_mod({ratio:'16:9'}); }); } }); })(jQuery); </script> <?php }
Best regards,
IsmaelSeptember 11, 2018 at 11:28 am #1008336Hi Ismael,
thanks for that workarround but fullscreen-icon is now available. but playing the video is not working anymore.
is there no options filter for the media player?! the script looks pretty big.thank you very much!
September 12, 2018 at 3:36 am #1008687Hi,
The videos are playing when I check the page and there’s the full screen icon. I also rechecked it on my own installation. (see private field)
There is no available filter for it, unfortunately, and you can’t stop the default script from initializing without removing it directly from the script file.Best regards,
IsmaelSeptember 12, 2018 at 8:16 am #1008785Hi,
the page still uses a “core”-fix. because i really cant get your script to work in my testing environment. are you sure it works? did you test it with a local mp4 file?
thanks!
September 13, 2018 at 1:12 am #1009132Hi,
It didn’t work when I retested it but I found the bug. Please try the script again.
// https://imgur.com/a/DUVHjGn
Best regards,
IsmaelSeptember 14, 2018 at 8:59 am #1009828Thanks! i can now confirm that the code script from above now works!
thanks again!
September 15, 2018 at 7:22 am #1009997Hi,
Great, glad you got it working :-)
Please let us know if you should need any further help on the topic or if we can close it.
Best regards,
RikardApril 5, 2021 at 3:06 pm #1292513Hi Ismael,
I used the code you recommended here. it works fine. my only problem is when I play the video I cannot see the full screen button. I have to pause it first and then the bottom appears. however I want the botton to be hidden in poster but the moment user plays the video the bottom appears. Please check my video in link below:
https://lostspiritgroup.comAlso: do you know how can I hide my controls in poster. so the controls shows when user play the video.
thanks so much for your help,
April 7, 2021 at 12:56 am #1292946Hi,
@hooman: We cannot find the html5 video in the front page. Where did you add it? You might have to directly modify the avia_html5_activation function in the themes/enfold/js/avia.js file, and add the “fullscreen” parameter in the the features array.
features: ['playpause','progress','current','duration','tracks','volume'],
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.