As a soccer enthusiast, I wanted a centralized web interface to watch live matches without navigating multiple streaming sites. Using a free public sports API, I built a fully client-side live sports player that aggregates ongoing, today’s, and popular matches across multiple sports. The application dynamically fetches match data, allows filtering by sport or team/title, and embeds live streams directly into a responsive web-based player without requiring any backend services.
Final Product: live Sports Player
The application consumes the public sports API to fetch sports categories, matches, and available stream sources. Data is dynamically rendered into an interactive UI where users can browse live matches, filter by sport, search by team or title, and select from multiple streaming providers for each match.
// Fetch live matches
async function loadMatches() {
const res = await fetch("https://streamed.pk/api/matches/live");
const matches = await res.json();
renderMatches(matches);
}
// Load selected stream into iframe player
function playStream(embedUrl) {
document.getElementById("player").src = embedUrl;
}
Many third-party stream providers attempt to open popup windows or redirect users. To improve user experience, popup interception logic was implemented to block new windows and instead load links within the embedded player.
// Block popup windows
window.open = function(url) {
console.log("Blocked popup:", url);
if (url) {
document.getElementById("player").src = url;
}
return null;
};
// Prevent target="_blank" links from opening new tabs
document.addEventListener("click", e => {
const link = e.target.closest("a[target=_blank]");
if (link) {
e.preventDefault();
document.getElementById("player").src = link.href;
}
});
The project successfully delivered a responsive and interactive live sports streaming web application that dynamically consumes a public REST API. Users can browse live and upcoming matches, filter by sport or team, and play streams directly within the interface. The entire solution runs client-side with no backend dependencies, demonstrating strong frontend engineering, API integration, and dynamic state management skills.