This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Playing Video on Start -Up
#1
Can I play a video on visualition start - up screen ?
Reply
#2
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);
    });
  }
});
Reply
#3
Do I need to add library or something else to use javascript code ?
Reply
#4
No, it is located in Scripting > Tools > Edit custom JavaScript.
Reply
#5
Oh i see thank you Admin.
Reply
#6
Hi admin  , I tried this script with this https://streamable.com/e/oqbnsj link but it didn't work.
Should i use another website
Reply
#7
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'
Reply
#8
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.
Reply
#9
You need to use apps login for FTP not ftp login. The base directory structure should look like this:
   
Reply
#10
It worked thanks.But some reason i have to use GIF instead of MP4.Could you please help me again ?
Reply
#11
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
Reply
#12
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. )
Reply
#13
You can use GIF but it will be much larger than a video file. Which Android version does your panel have?
Reply
#14
Android 7.1.2 runs on panel.
Reply


Forum Jump: