Cricket Audio Commentary Stream Integration Documentation
- Ankita Kumar
- Dec 23, 2024
- 2 min read
Updated: Dec 24, 2024

Overview
This document provides comprehensive guidance for integrating our cricket audio streaming service into your platform using HLS (HTTP Live Streaming) URLs. Our service supports multiple Indian languages and can be integrated into web, mobile, and desktop applications.
Authentication
To access the streaming API, you'll need:
API Key (to be provided during onboarding)
Client ID
Client Secret
Authentication Endpoint
Request Headers
Content-Type: application/json
X-API-Key: your_api_key
`
Request Body
Request
{
"client_id": "your_client_id",
"client_secret": "your_client_secret"
}
Response
{
"access_token": "Bearer_token",
"expires_in": 3600,
"token_type": "Bearer"
}
Getting Stream URL
Stream URL Endpoint
`
Request Headers
Authorization: Bearer {access_token}
Content-Type: application/json
Query Parameters
`language`: Language code (e.g., "hi" for Hindi, "en" for English)
`quality`: Stream quality (low, medium, high)
Response
{
"stream_url": "https://stream.verityai.co.in.com/match/{match_id}/master.m3u8",
"language": "hi",
"quality": "high",
"expires_at": "2024-12-24T00:00:00Z"
}
Integration Examples
HTML5 Video Player
html
<video id="player" controls>
<source src="HLS_URL_HERE" type="application/x-mpegURL">
</video>
<script>
if (Hls.isSupported()) {
const video = document.getElementById('player');
const hls = new Hls();
hls.loadSource('HLS_URL_HERE');
hls.attachMedia(video);
}
</script>
React Integration
import Hls from 'hls.js';
import { useEffect, useRef } from 'react';
const AudioPlayer = ({ streamUrl }) => {
const audioRef = useRef(null);
useEffect(() => {
if (Hls.isSupported() && audioRef.current) {
const hls = new Hls();
hls.loadSource(streamUrl);
hls.attachMedia(audioRef.current);
}
}, [streamUrl]);
return <audio ref={audioRef} controls />;
};
Android Integration (Kotlin)
import com.google.android.exoplayer2.MediaItem
import com.google.android.exoplayer2.SimpleExoPlayer
class AudioPlayerActivity : AppCompatActivity() {
private var player: SimpleExoPlayer? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
player = SimpleExoPlayer.Builder(this).build()
val mediaItem = MediaItem.fromUri(streamUrl)
player?.setMediaItem(mediaItem)
player?.prepare()
}
}
iOS Integration (Swift)
import AVKit
import AVFoundation
class AudioPlayerViewController: UIViewController {
var player: AVPlayer?
func setupPlayer(withURL streamURL: URL) {
let playerItem = AVPlayerItem(url: streamURL)
player = AVPlayer(playerItem: playerItem)
player?.play()
}
}
Error Handling
Common Error Codes
`401`: Invalid or expired authentication
`403`: Unauthorized access
`404`: Stream not found
`429`: Rate limit exceeded
`500`: Server error
Error Response Format
{
"error": {
"code": "ERROR_CODE",
"message": "Detailed error message",
"details": {}
}
}
Rate Limits
- Authentication API: 100 requests/hour
- Stream URL API: 1000 requests/hour
- Per IP address and API key combined
Support
For technical support or integration assistance:
- Email: support@verityai.co.in
Comments