Snapping Games
Obtaining live sporting event information by 'snapping'
Integration
The following section deals primarily with the code used in capture of live game information for SnapOdds Operator. If your use case requires game odds to be presented, the information captured by SnapOdds Operator is fed into SnapOdds Sports Media to correlate the game odds information, as described in Game Odds.
Description
With this configuration, the web component is able to "snap" an image of a live TV stream and retrieve information on the currently playing sporting event shown. It is expected that the customer's web application will use the response from the SDK to render more detailed information about the sporting event.
First, ensure both the JavaScript and CSS resource are correctly loaded and that the access token manager is correctly implemented.
To render the SnapOdds SDK component, a DOM element must be provided, to which the component will be attached to as a child. In most cases, the document.body
component works best, as the SDK is then added as the last child, which helps with styling as the SDK overlays the full viewport.
Next, it is necessary to configure the SDK and add it as a child to the DOM element of your choice. This can be done by using SnapoddsSdk.snapBuilder()
.
Show SDK immediately
The following configuration is the simplest one and will show the SDK immediately after appendTo()
is called.
Show SDK only if sportEvents are live
The SDK can provide you with the information if there is at least one sportsEvent live, based on your channel's configuration.
Instead of appending the SDK to the document.body
, you need to configure the onLiveEventsStatusChangedCallback()
first. Therefore, you have to call build()
instead of appendTo()
at the end of the SDK's initialisation in order for it to work.
The callback you provide will be executed after initialisation and will return either true
or false,
indicating that there is at least one live sportsEvent available or not.
After that, it will automatically check every 5 minutes for upcoming sportEvents. If one is found the callback will be invoked as soon as the sportsEvent starts..
The following parameters are used in the SnapoddsSdk.operatorsBuilder()
:
SDK Configuration Options
Result format
tvSearchResult
has the following format:
Last updated