yt player's codebase is primarily written with jQuery.
The code structure of the project is as follows:
player and element variables
- player variables initiallized such asurl
,videoId
dom elements stored for easy manipulation later
helper functions
getVideoURL()
- value of URL inputted and passes it togetId
validate()
- tests the URL inputted againsturlDissector
to see if it is a valid urlgetId()
- takesurl
and returns the video id, the id is then passed toloadVideo()
loadVideo()
- takesvideoId
and opens$overlay
and sets video player stateopenFullscreen()
- request iframe fullscreenreset()
- reset player to inital stateopenVideo()
- open video on youtube.com in popup windowopenOverlay
- open video overlaycloseOverlay
- close video overlayminimizeOverlay()
- hide overlay and show thumbnail of video that can be clicked to reopen the overlaysetNotification()
- send a player notification, takesmessage
, (notification)level
, andduration
in seconds.clearNotification()
- clears any notifications that are displayed
event listeners
- run
validate()
on page load in case the browser has stored a url in the input field
git clone [email protected]:unrealapex/yt-player.git
cd yt-player
xdg-open index.html
Formatting should be done with Prettier. Commits should be formatted with the conventional commits specification PRs that do not meet these standards will be rejected.