Logic Machine Forum
Playing Video on Start -Up - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: Playing Video on Start -Up (/showthread.php?tid=3986)



Playing Video on Start -Up - mkaymak - 11.04.2022

Can I play a video on visualition start - up screen ?


RE: Playing Video on Start -Up - admin - 11.04.2022

Via Custom JavaScript. Change video source as needed. This script will only affect Usermode visualization but not Touch, Schedulers or Trends.
Code:
$(function(){
  if ($('body').hasClass('usermode')) {
    var src = 'https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4';
    
    var el = $(
      '<video muted="true" autoplay="true">' +
        '<source src="' + src + '" type="video/mp4">' +
      '</video>'
    ).css({
      'position': 'absolute',
      'top': 0,
      'left': 0,
      'width': '100%',
      'height': '100%',
      'z-index': 9999,
      'background': 'white'
    }).appendTo('body');
    
    el.on('ended click', function() {
      el.off();
      
      el.css({
        'transition': '0.5s',
        'opacity': 0
      });
      
      setTimeout(function() {
        el.remove();
      }, 500);
    });
  }
});



RE: Playing Video on Start -Up - mkaymak - 11.04.2022

Do I need to add library or something else to use javascript code ?


RE: Playing Video on Start -Up - admin - 11.04.2022

No, it is located in Scripting > Tools > Edit custom JavaScript.


RE: Playing Video on Start -Up - mkaymak - 11.04.2022

Oh i see thank you Admin.


RE: Playing Video on Start -Up - mkaymak - 28.04.2022

Hi admin  , I tried this script with this https://streamable.com/e/oqbnsj link but it didn't work.
Should i use another website


RE: Playing Video on Start -Up - admin - 28.04.2022

You need a direct link to .mp4 video file but it won't work with streamable because it only provides a temporary link to the file. If the video file is not big you can upload it directly to LM via FTP into public directory (using apps login). Then set src to '/public/VIDEO_FILE_NAME.mp4'


RE: Playing Video on Start -Up - mkaymak - 28.04.2022

When connected to LM there is no directory such as public so i created it and uploaded the video file ( which is 1.8 mB ) but is doesn't work anyway.


RE: Playing Video on Start -Up - admin - 28.04.2022

You need to use apps login for FTP not ftp login. The base directory structure should look like this:
   


RE: Playing Video on Start -Up - mkaymak - 28.04.2022

It worked thanks.But some reason i have to use GIF instead of MP4.Could you please help me again ?


RE: Playing Video on Start -Up - admin - 28.04.2022

Which browser and on what device are you testing this with? Check if you can access the video file directly from your browser: http://LM_IP/public/VIDEO_FILE_NAME.mp4


RE: Playing Video on Start -Up - mkaymak - 28.04.2022

I'm using an Android based touchscreen for HMI purpose.My guess is android version doesn't support mp4 file type.
But it works with common browsers ( Chrome, opera, etc. )


RE: Playing Video on Start -Up - admin - 28.04.2022

You can use GIF but it will be much larger than a video file. Which Android version does your panel have?


RE: Playing Video on Start -Up - mkaymak - 27.05.2022

Android 7.1.2 runs on panel.