---
# System prepended metadata

title: SOM Video Player

---

# SOM Video Player

This is only a description of a planned implementation, this is NOT implemented yet:

The SOM Video Player component has the following responsibilities:
* playback of a video
* switch to ad playback and back to video
* signal events:
	* start
	* first-quartile
	* middle
	* third-quartile
	* end

API outline:

## VideoPlayer

The main publicly available interface.

### VideoPlayer.initialize(domElement)

Initializes the Video Player and binds it to the provided DOM element (an HTML5 player or a proprietary Samsung video player component, in case HTML5 is not supported on the device).

### VideoPlayer.load(url)

Loads video content from the provided URL and prepares for play-back. Unloads any previous video content, that has been prepared before. Returns a play-back object (see below).

### VideoPlayer.dispose()

Disposes of any internally prepared video content. Detaches from any HTML elements and removes all event-listeners. Can be called to manually free up resources.

## PlayBack

An object exposing the video play-back interface. The only way to get an instance is a call to VideoPlayer.load()

### playBackInstance.play()

Resumes play-back at the current position

### playBackInstance.stop()

Stops play-back and rewinds to the beginning position.

### playBackInstance.pause()

Stops play-back without changing the current position.

### playBackInstance.fastForward(), playBackInstance.rewind()

TBD

### playBackInstance.showAd(url, callback)

Displays an add from the provided URL, pausing the video play-back. The provided callback with signature `error => {}` is invoked, in case an error occurs or with `error === null`, when the ad has ended succesfully.

Video play-back is NOT resumed automatically.

### addEventListener(eventType, listenerFunction)

Adds an event listener for the given type. Types include:
* start
* first-quartile
* middle
* third-quartile
* end

Returns a function to remove the event listener.

# Legacy Wrapper

It is necessary to provide a wrapper around SOM Video Player and Somtag client library, so that the publisher can continue using the same API, as the OTT-Layer had before.

The legacy interface has to mirror the following [API](https://github.com/SevenOneMedia/adtec-ottlayer/blob/063ff6f90d2b7eb8678e050fb1ba37db32760417/src/adlayer/adlayer-hbbtv.js#L1749)

The Wrapper uses the Somtag library to query the ad-slots and passes the data on to the Video Player for play-back.