Site Tools


Hotfix release available: 2025-05-14b "Librarian". upgrade now! [56.2] (what's this?)
Hotfix release available: 2025-05-14a "Librarian". upgrade now! [56.1] (what's this?)
New release available: 2025-05-14 "Librarian". upgrade now! [56] (what's this?)
Hotfix release available: 2024-02-06b "Kaos". upgrade now! [55.2] (what's this?)
Hotfix release available: 2024-02-06a "Kaos". upgrade now! [55.1] (what's this?)
New release available: 2024-02-06 "Kaos". upgrade now! [55] (what's this?)
Hotfix release available: 2023-04-04b "Jack Jackrum". upgrade now! [54.2] (what's this?)
Hotfix release available: 2023-04-04a "Jack Jackrum". upgrade now! [54.1] (what's this?)
New release available: 2023-04-04 "Jack Jackrum". upgrade now! [54] (what's this?)
Hotfix release available: 2022-07-31b "Igor". upgrade now! [53.1] (what's this?)
Hotfix release available: 2022-07-31a "Igor". upgrade now! [53] (what's this?)
New release available: 2022-07-31 "Igor". upgrade now! [52.2] (what's this?)
New release candidate 2 available: rc2022-06-26 "Igor". upgrade now! [52.1] (what's this?)
New release candidate available: 2022-06-26 "Igor". upgrade now! [52] (what's this?)
Hotfix release available: 2020-07-29a "Hogfather". upgrade now! [51.4] (what's this?)
New release available: 2020-07-29 "Hogfather". upgrade now! [51.3] (what's this?)
New release candidate 3 available: 2020-06-09 "Hogfather". upgrade now! [51.2] (what's this?)
New release candidate 2 available: 2020-06-01 "Hogfather". upgrade now! [51.1] (what's this?)
New release candidate available: 2020-06-01 "Hogfather". upgrade now! [51] (what's this?)
Hotfix release available: 2018-04-22c "Greebo". upgrade now! [50.3] (what's this?)
Hotfix release available: 2018-04-22b "Greebo". upgrade now! [50.2] (what's this?)
a

jwplayer-tracker

A jwplayer (version 5) plugin to track video the below information session by session.

- Progress

- Time spent on the video in any session

- video length

- Browser/Device (not included in params. Just read “user-agent” header of each request)

- Also, lets you resume from the video from the last left point if you choose to.

Code

Sample Usage

1. Download jwplayer_tracker.js OR jwplayer_tracker.min.js

2. Include needed files in your HTML page

<script type="text/javascript" src="jwplayer.js"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.7.1.min.js"></script>

- Configure the plugin while initializing the player.

<script type="text/javascript">
      jwplayer("mediaplayer").setup({
        flashplayer: "player.swf",
        file: "<FILE URL>",
        image: "<IMG>",
        'plugins': {'/<PATH>/jwplayer_tracker.js': {
            url: '/<URL>',
            progress: 25,
            resume_from_last: true,
            debug: true,
            frequency: 15,
            progress_only: false,
            additional_data: {
              user_email: "this@that.com",
              user_locale: "en-US"
            }
          }}
      });
    </script>

Please check examples/tracker.html for sample configuration.

Config Options

Option Explanation
url The URL on your app to which progress needs to be updated to. (This field is required)
progress The initial progress percentage (probably the progress in the previous session.)
resume_from_last Should the playback start from the last left place? (true/false - default is false). The playback resumes based on 'progress' field's value.
frequency How frequently the progress info should be sent to the url (default - 10 ie every 10 secs)
progress_only If set to true, only progress info is sent to server and it is sent only when there is some progress made. (true/false - default is false). Use this if you only want progress but not session time spent.
additional_data If you like to pass any additional params along with progress info, they can be set during initialization. (any json/object)

Information Received By Server

{   session_id: ,
    previous_position: ,
    current_position: ,
    progress: ,
    video_duration: ,
    total_session_duration:,
    additional_data: ...}
Param Explanation
session_id A globally unique session id string that helps to identify and store data per session. Every time the video player gets launched, a new session id gets created.
previous_position The position of the video controlbar when last update happend (in secs)
current_position The position of the video controlbar at present (in secs)
progress The overall percentage of video is watched so far (percentage, max value is 100). This just means the highest point in the timeline so far.
video_duration Total video length (in secs)
total_session_duration Total amount of time spent watched in this session (in secs.). This is cumulative and calculates the replays, seeking back and etc.
additional_data additional data initialized

Tips

- It has been observed that with the open source streaming tools we use, on a rare occasion streaming fails and the player receives huge numbers as video duration. To avoid this, it's advised to store the video duration in the DB on server.

- 'progress' can be calculated using 'previous_position', 'current_position' and 'video_duration' fields on the server as well. Just take care that it never exceeds 100 and cant be negative.

Contributing

Please help with your contribution by filing any issues if found. Pull requests are welcomed :)

a.txt · Last modified: 2018/08/31 16:16 (external edit)