How mitthu786/ts-jiotv works
Project Type and Purpose
• This is a monolithic PHP‑based streaming web application (LAMP stack) providing live and 7‑day catchup TV for JioTV channels.
• It contains both presentation (HTML/CSS/JS) and application logic (PHP scripts for login, API proxying, playlist generation, streaming).
File‑Structure Analysis
• Top‑Level
– index.php and .htaccess: entry point and routing rules
– app/: contains all application logic, assets, sub‑modules
• app/assets/: static files (CSS, JavaScript, placeholder data)
• app/login/: OTP login, session management
• app/catchup/: catchup TV logic, API calls, proxy support
• play.php, playlist.php, stream.php: streaming entry points
• app/functions.php and app/catchup/cpfunctions.php: shared helper functions (proxy flag, JioTV API wrappers)
Key Components
a. Client Layer
– Web browsers (desktop, mobile, Android TV)
– JS player (JWPlayer), search UI
b. Web Server
– Apache (with .htaccess rules)
– PHP 7.4+ runtime
c. Application Layer (PHP Modules)
– Authentication Module (app/login)
– Catchup Module (app/catchup)
– Playlist/Streaming Controllers (play.php, playlist.php, stream.php)
– Shared Services (functions.php, cpfunctions.php)
d. External Dependencies
– JioTV public/private streaming APIs
– Optional proxy endpoint (configured via $PROXY)
e. Static Assets
– CSS, JS delivered from app/assets
f. Clients for Third‑Party Services
– OTP provider (SMS gateway)
– Channel metadata (search, filters)
Relationships and Data Flow
• User → Browser → HTTP GET/POST → Apache
• Apache routes requests via .htaccess to index.php or specific controllers
• Controllers invoke shared functions to:
– Validate session/OTP
– Proxy streaming / catchup API calls to JioTV endpoints (via cpapi, cpstream)
– Generate M3U playlist or HLS stream URLs
• Server → Response
– HTML pages (injected with JS player)
– JSON/AJAX for search, filters
– M3U8 or TS segments for player
• Browser/JWPlayer → Playback requests (chunked delivery)
Architectural Patterns and Principles
• Modular organization: separate sub‑directories for each functional area
• Controller‑Helper pattern: small PHP entry scripts call shared helper functions
• No relational database: filesystem or in‑memory session storage
• Proxy abstraction: toggled via configuration ($PROXY)