/* Movie App - Common Configuration If the app folder is renamed, update APP_NAME below and all paths will automatically adjust everywhere this file is included via requirepkg(). */ // ── App identity ───────────────────────────────────────────────────────────── var APP_NAME = "Movie"; var BACKEND_PATH = APP_NAME + "/backend/"; // ── Server API endpoints (relative from any page in this app) ──────────────── var MEDIA_API = "../media"; // ?file= streams a file var TRANSCODE_API = "../media/transcode"; // ?file var HLS_API = "../media/hls"; // ?file same transcode, as an HLS playlist var PROBE_API = "../media/probe/"; // ?file real codecs + playability var STORYBOARD_API = "../media/storyboard/"; // ?file[&image=1] scrub previews var SUBTITLE_API = "../media/subtitles/"; // ?file[&track=n|&font=n] embedded tracks var AGI_INTERFACE = "../system/ajgi/interface?script="; // ── Script paths (used when calling ao_module_agirun from the frontend) ────── var SCRIPT_GET_LIBRARY = BACKEND_PATH + "getLibrary.js"; var SCRIPT_GET_LIBRARY_CACHE = BACKEND_PATH + "getLibraryCache.js"; var SCRIPT_GET_EPISODES = BACKEND_PATH + "getEpisodes.js"; var SCRIPT_GET_THUMBNAIL = BACKEND_PATH + "getThumbnail.js"; var SCRIPT_LIST_FOLDER = BACKEND_PATH + "listFolder.js"; var SCRIPT_GET_MOVIE_INFO = BACKEND_PATH + "getMovieInfo.js"; var SCRIPT_DISABLE_MOVIE_INFO = BACKEND_PATH + "disableMovieInfo.js"; var SCRIPT_GET_WATCHTIME = BACKEND_PATH + "getWatchTime.js"; var SCRIPT_SET_WATCHTIME = BACKEND_PATH + "setWatchTime.js"; var SCRIPT_GET_INDEX_STATS = BACKEND_PATH + "getIndexStats.js"; var SCRIPT_CLEAR_INDEX = BACKEND_PATH + "clearIndex.js"; // ── Streaming mode ─────────────────────────────────────────────────────────── // Formats the browser cannot decode are transcoded on the fly, and there are // two ways to deliver that transcode: // // mp4 a single fragmented MP4 streamed down one response. The long-standing // default: it starts fastest and costs the server nothing but the ffmpeg // process. It cannot answer byte-range requests, which WebKit clients // (Safari, and every browser on iOS) require before they will play // anything, so on those it fails outright. // hls the same transcode cut into segments behind a playlist. Every segment // is a finite, seekable file, so WebKit plays it and seeking inside the // transcoded window no longer restarts the stream. // // "auto" picks hls on WebKit and mp4 everywhere else (Firefox, Chrome, Edge on // Windows and Linux). HLS exists for WebKit's sake and is not the better choice // where MP4 works: the MP4 transcode writes into the response, so the client's // reading pace holds ffmpeg back and closing the player ends it, while an HLS // session writes the whole film to temp disk as fast as the CPU allows and // outlives the player until it is reaped. Other browsers can still choose HLS // in settings; they play it through Media Source (see nativeHLSSupported). var STREAM_MODE_KEY = "movie_stream_mode"; // Fired on the