Skip to content

i4edubd/livetv

Repository files navigation

Live TV Android Application

Android Kotlin Jetpack Compose

A native Android Live TV streaming application built with Kotlin and Jetpack Compose, featuring ExoPlayer (Media3) for HLS/M3U8 video playback.

🎯 Overview

This application provides a modern, user-friendly interface for streaming live TV channels from a local HTTP server. It features category-based browsing, thumbnail previews, and real-time streaming with professional video playback controls.

✨ Features

  • πŸ“Ί HLS/M3U8 Video Streaming with ExoPlayer (Media3)
  • 🎨 Modern UI built entirely with Jetpack Compose
  • πŸ“‚ Category Filtering (Bangla, English, Hindi, Islamic, Kids, Sports)
  • πŸ–ΌοΈ Channel Grid with thumbnail images
  • πŸ‘₯ Active Users Indicator (simulated real-time updates)
  • πŸ”’ Network Security configured for local HTTP server
  • πŸ“± 16:9 Video Player with adaptive layout
  • 🎯 Auto-play first channel on launch

πŸ—οΈ Architecture

Technology Stack

  • Language: Kotlin
  • UI Framework: Jetpack Compose (Material 3)
  • Video Player: ExoPlayer (Media3) with HLS support
  • Image Loading: Coil
  • HTML Parsing: Jsoup
  • Async Operations: Kotlin Coroutines
  • Build System: Gradle

Key Components

Component Description
MainActivity.kt Main activity with Compose UI and player lifecycle
Channel.kt Data model for channel information
ChannelParser.kt Utility for parsing HTML channel lists
Network Security Config Allows cleartext HTTP to local server (10.200.13.14)

πŸš€ Quick Start

Prerequisites

  • JDK 8+ installed
  • Android SDK (API 33+)
  • Network access to download dependencies

Build the App

Debug Build

./gradlew assembleDebug

πŸ“¦ Output: app/build/outputs/apk/debug/app-debug.apk

Release Build

./gradlew assembleRelease

πŸ“¦ Output: app/build/outputs/apk/release/app-release.apk

Install

adb install app/build/outputs/apk/debug/app-debug.apk

πŸ“‹ Configuration

Server Configuration

The app connects to a local HTTP server:

  • Base URL: http://10.200.13.14/
  • Stream Endpoint: player.php?stream={ID}
  • Image Path: assets/images/{CHANNEL_NAME}.png

To change the server, edit ChannelParser.kt:

private const val BASE_URL = "http://YOUR_SERVER_IP/"

Network Security

The app is configured to allow cleartext HTTP traffic to 10.200.13.14:

<!-- res/xml/network_security_config.xml -->
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">10.200.13.14</domain>
    </domain-config>
</network-security-config>

πŸ“± Screenshots

UI Components

  1. Top Bar: Logo and active users count
  2. Video Player: 16:9 aspect ratio with player controls
  3. Category Tabs: Scrollable horizontal tabs
  4. Channel Grid: 3-column grid with thumbnails

πŸ”§ Customization

Add New Channels

Edit ChannelParser.kt:

fun getSampleChannels(): List<Channel> {
    return listOf(
        Channel("ID", "Channel Name", "Category", "Image URL"),
        // Add more channels...
    )
}

Parse HTML Channel List

The parser supports this HTML format:

<li data-type="Sports">
    <a onclick="view.location.href='player.php?stream=88'">
        <img src="assets/images/A_SPORTS_HD.png">
    </a>
</li>

Use ChannelParser.parseChannels(html) to extract channel data.

Modify UI Theme

Edit MainActivity.kt:

@Composable
fun LiveTVTheme(content: @Composable () -> Unit) {
    MaterialTheme(
        colorScheme = lightColorScheme(
            primary = Color(0xFF6200EE),    // Change colors
            secondary = Color(0xFF03DAC5),
            background = Color(0xFFF5F5F5)
        ),
        content = content
    )
}

πŸ“¦ Dependencies

// ExoPlayer (Media3)
implementation 'androidx.media3:media3-exoplayer:1.0.2'
implementation 'androidx.media3:media3-exoplayer-hls:1.0.2'
implementation 'androidx.media3:media3-ui:1.0.2'

// Jetpack Compose
implementation platform('androidx.compose:compose-bom:2023.01.00')
implementation 'androidx.compose.ui:ui'
implementation 'androidx.compose.material3:material3'

// Coil for images
implementation 'io.coil-kt:coil-compose:2.2.2'

// HTML parsing
implementation 'org.jsoup:jsoup:1.15.4'

πŸ” Security

Keystore Information

⚠️ Development Keystore (included for demo purposes only)

  • File: app/keystore.jks
  • Store Password: livetv123
  • Key Alias: livetv
  • Key Password: livetv123

⚠️ For production: Generate a new keystore and store credentials securely!

keytool -genkeypair -v -keystore release.jks -keyalg RSA -keysize 2048 \
        -validity 10000 -alias my-key

πŸ› Troubleshooting

Build Issues

Problem: Dependencies fail to download
Solution: Ensure internet connectivity. The project uses Maven Central and Google repositories.

Problem: Android SDK not found
Solution: Set ANDROID_HOME environment variable to your SDK location.

Runtime Issues

Problem: Video doesn't play
Solution:

  • Verify server at 10.200.13.14 is accessible
  • Check stream URL format: http://10.200.13.14/player.php?stream=88
  • Ensure network security config is properly configured

Problem: Images not loading
Solution:

  • Verify image URLs are correct
  • Check server is serving images from /assets/images/
  • Ensure internet permission is granted

πŸ“„ License

This project is provided as-is for educational and development purposes.

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“ž Support

For issues or questions, please open an issue on GitHub.


Built with ❀️ using Kotlin and Jetpack Compose

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published