• Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below
  • Forum
  • Website
  • GitHub
  • Status
  • Translation
  • Features
  • Team
  • Rules
  • Help
  • Feeds
User Links
  • Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below

    Useful Links Forum Website GitHub Status Translation Features Team Rules Help Feeds
    Jellyfin Forum Development Web Development function user inactive

     
    • 0 Vote(s) - 0 Average

    function user inactive

    user sleeping
    Jobar
    Offline

    Junior Member

    Posts: 3
    Threads: 1
    Joined: 2024 May
    Reputation: 0
    Country:France
    #1
    2024-09-10, 09:37 AM (This post was last modified: 2024-09-10, 05:12 PM by Jobar. Edited 1 time in total.)
    Hi,

    I just created a function to manage user inactivity during continuous playback. Indeed, if the user is asleep or away, the playback continues indefinitely.
    To get around this problem, my script runs a timer and checks that there is no keyboard or mouse event otherwise it resets the timer.
    If the time is up, a popup will be displayed to confirm whether or not the user is present.
    without a response from the user, this popup appears 30 seconds and redirects Jellyfin to the home page.
    This script does not display the popup on the home page and dashboard.

    To integrate it, a modification of the index.html page is enough.

    There is just the choice of:
    - The duration of inactivity chosen: 3 hours by default.
    - The duration of the popup: 10 seconds by default.
    - translate texts into the language of the user.

     inactive.user.js

    JoBar.
    Jobar
    Offline

    Junior Member

    Posts: 3
    Threads: 1
    Joined: 2024 May
    Reputation: 0
    Country:France
    #2
    2024-10-01, 04:29 AM
    The detection is based on keyboard and mouse events. The script does not detect if someone is in front of the screen. 
    It activates as soon as Jellyfin is not on its home page.

    The delay I chose for the script is 3 hours. 
    It can be easily modified via the variable ''var nbminute = 180; // Inactive delay in minutes'' at the beginning of the script.

    The events are intercepted through this line of code: ''if (/^on(key|mouse)/.test(key)) {'', you can customize it to choose your events.

    The detection of the home page or the Dashboard is done by this line of code: ''if('/home.html' != page && page.includes('/dashboard') === false){''

    You can add or remove pages to define on which pages the script should trigger.

    Just a heads-up for the home page. 
    When the script is executed, if no action is performed, the script redirects to the home page. 
    If it is removed from the excluded pages test, the script will loop, and this is not desired in my opinion.

    A small note, I’ve only been using Jellyfin for a short time, so I haven't been able to confirm its functionality on all configurations. 
    It might not be executed on certain client apps.

    I hope I have answered your question.

    JoBar.
    « Next Oldest | Next Newest »

    Users browsing this thread: 1 Guest(s)


    • View a Printable Version
    • Subscribe to this thread
    Forum Jump:

    Home · Team · Help · Contact
    © Designed by D&D - Powered by MyBB
    L


    Jellyfin

    The Free Software Media System

    Linear Mode
    Threaded Mode