-
Notifications
You must be signed in to change notification settings - Fork 6
Video library wrapper
The video library renders a video player that provides a unified experience on all supported browsers, selecting the best fitting media stream (locator), fullscreen function, etc. All player libraries have a slightly different way to access their API. For being able to communicate to the player in the same way (and making it possible to use different kinds of players) we decided to wrap the the player in a slim player object with the necessary API features.
For a reference with the VideoJS wrapper, see the videojs-adapter.coffee file.
When the Lime player gets instantiated we call the LIMEPlayer.VideoPlayerInit method
When the Lime player gets instantiated, it calls the VideoPlayerInit method with the three parameters (domElement, optionsHash, callback) and waits for the callback to be called with the instantiated video player.
Following the CommonJS best-practice way of implementing callback method, the callback parameter method expects
two parameters: (error, player). If no error happened, the first parameter should be null.
The second parameter is the player object with the following features:
-
player.isFullscreen():returns booleanReturns whether the player is in full screen mode. -
player.play():voidStarts to play at the current position. -
player.pause():voidPauses the video. -
player.getLength():numberReturns the length of the video in seconds. -
player.seek(position):voidJumps to the positionposition(in seconds). -
player.currentTime():numberReturns the current time position in the video. -
player.currentSource():stringReturns the uri of the stream that is being played.
The Lime player uses
- `
-
player.videoOverlayis a reference to the DOM element exactly over the video element. This element has to be visible and resized automatically in case the video would be resized or switched to full screen mode. -
player.timelineOverlayis a reference to the DOM element over the timeline where the player head is moving. If for example the player hides the timeline while playing, this element should be hidden as well and showed when the player shows the timeline again. -
player.buttonContaineris a reference to the DOM element of additional switches for the case that a plugin would need a switch or push button.