Professional Documents
Culture Documents
js
ESOF
Class 3MIEIC04
Group 4:
1
20/12/2018
ÍNDICE
2
Video.js Introduction
Video.js is an open source library for working with video on the web, also
known as an HTML video player. It supports HTML5, Flash, YouTube and
Vimeo.
It’s an active project, with almost daily new commits and it has over 300
contributors.
Approximately 400.000 websites use video.js, which means it is utilized
on a worldwide basis.
System Architecture
3
Figure 1 - Video.js system architecture diagram
4
Issue #5581 – Autoplay
This issue was brought up because the autoplay functionality does not
work in Chrome when toggled on.
As the name indicates, the autoplay attribute consists on automatically
playing a video as soon as the page is loaded, without having to click on the play-
button.
Autoplay can be called on the data-setup or in the video tag itself,
separately or simultaneously and it won’t activate either way. The code snippet
below, demonstrates how to recreate the issue using video.js.
5
Requirements
The issue was opened about a month ago, by user “afridley”, who when
trying to toggle autoplay on, realized that the video wouldn’t do what was
supposed to do. Here is a snippet of how he describes his user experience:
This issue occurs in Chrome 70, where it only shows a frame of the video
(see image below) without automatically reproducing it.
6
To better comprehend the issue at bay we created a use case diagram that
demonstrates how the issue is approached from the point of view of the user:
The first step in order to accomplish the fix of the issue is to assess and
determine what are the files directly and indirectly related to the issue.
7
List of files indirectly involved with the issue:
component.js – File that contains the main class for most objects present in
video.js.
button.js – It represents most of the buttons used on the control-bar of the video.
big-play-button.js – File that specifically involves everything about the play
button that appears in the middle of the video-screen.
control-bar.js – Code that possesses the controller of the main controls available
in video.js.
In order to automatically start playing the video the autoplay option needs
to be properly defined. The following is a code snippet related to autoplay:
8
A class diagram is the best way to exemplify all the connections between
the six files that are directly involved with the autoplay issue. We made sure to
add the main functions related to the issue, of each file, to the diagram for it to be
easily understandable.
9
When trying to create a fix, Google released a new Google Chrome
version. For our amazement, we concluded that the problem may not have been
with the coding of video.js but with some functionality related to Chrome that
was stopping the autoplay option from doing its job.
We designed a sequence diagram to show how the issue was solved
without having to manipulate any source code:
Unfortunately, no source code fix was made by us, since in all honesty, we
didn’t think something was wrong with the code. If that weren’t the case it
autoplay would still now work in the new version of Chrome, or at least not work
on another browser.
Fix Validation
We tested if autoplay was only deactivated in Chrome 70, and that came
to be true. Microsoft Edge, Safari, Mozilla Firefox and IE were all able to
autoplay the test video, as was Google Chrome after its update to Chrome 71.
10
Submission of the Fix
Sadly, no fix was submitted for the reasons explained above. We would
like to add that we did our best to be able to create a fix but, could not do it as
other programmers haven’t been able to do it for the last month.
11
Issue #5604 – Full Screen
In this second issue, it is stated that when the user sets the full screen
option off, the full screen option disappears like it was intended, but when the
user double clicks on the video it still goes right onto full screen. The following
image is the script introduced in a HTML test file that disables the full screen
button:
Requirements
The issue was also opened about a month ago, this time by user
“bantikyan”, who created a script that set the fullscreenToggle option to false, or
in other words that stopped the viewer from watching the intended video in full
screen. In his words, the video “on double click goes to full screen”, hence
reducing the user experience and the opening of this important issue.
12
The most important thing that video.js and most programs focus on, is the
ability of any person to be able to utilize the programs’ full capabilities. When
that doesn’t happen, it is never good.
Put that, we created a use case diagram that represents with simplicity but
objectivity what happens to the user when this issue occurs:
Following the approach to the first issue, the first step in order to
accomplish the fix of the issue is to assess and determine what are the files
directly and indirectly related to the issue.
13
fullscreen-api.js – Stores every browser-specific methods for the full screen API.
fullscreen-toggle.js – Code that is capable of toggling full screen mode on and
off whenever it is necessary.
component.js – File that contains the main class for most objects present in
video.js.
control-bar.js - Code that possesses the controller of the main controls available
in video.js.
List of files indirectly involved with the issue:
video.js – File that creates the video options chosen by the user.
setup.js - Sets up any tags that may have been toggled on. It also checks if the
video has been loaded and is ready to be played.
clickable-component.js – File that handles any component that must be clicked
or keyboard actionable.
menu-button.js – Contains code that handles every menu button, like the full
screen button, for example.
14
Design of the Fix
15
We also made a class diagram for this issue, using the six most important
files that would help us solve the issue at hand. It represents the different
connections between them and it also contains functions of each file that are
related to the full screen activation and the double-click event:
16
We know had a pretty clear idea of the path we had to take to get to our
destination: the issue fix. And what better way to represent that path, than a
sequence diagram designed by us?
17
Source Code Fix
The idea was that if the control bar possessed the fullscreenToggle button,
double-clicking on the video would allow for full screen to be activated and
deactivated. If that button is not present, which happens when fullscreenToggle is
turned off, going to full screen even after double-clicking on the video becomes
impossible, just as we intended.
So, we managed to find a fullscreenToggle property el_ that contains the
value “true” whenever it is enabled and “false” whenever it isn’t.
Finally, we only had to call the if clause with this property before the
requestFullscreen function that triggers full screen mode.
With these resources at hand it was with great sense of accomplishment
that we coded a fix.
18
Fix Validation
Firstly, we created a sandbox to be able to change our code easily and see
how the test video would react to the changes that we were constantly making.
When we came up with the code displayed in the last figure, we were happy to
see that the video reacted the way that we wanted it to react: full screen no longer
activated, no matter how many times one was able to double-click repeatedly!
Our code also went through the Travis CI build to check if every single
new line was according to the rest of the player.js file.
Finally, a last check was performed to see if there were no code errors and
it resulted in a positive result.
19
After completing 2 different checks…
From what we understood, our fix was not accepted not because it didn’t
fix the issue that we were working on, but because it wasn’t a general fix since a
custom full screen button could possibly exist.
Apparently, another PR with an option that can be inserted by the user to
disable double-click to full screen is ready to be merged in the upcoming update
of video.js.
From these facts, we can affirm that we solved the issue that we were
directly working on and are proud of our work. However, other more general
issues related to the same aspects of our issue already had different fixes
preferred by the project’s admins.
Wrap-up
20