diff mrjunejune/BUILD @ 242:543df0fe7168

[tools] Add full HLS player support
author MrJuneJune <me@mrjunejune.com>
date Mon, 03 Aug 2026 13:14:41 -0700
parents 9c2eec61a152
children b8aa08503378
line wrap: on
line diff
--- a/mrjunejune/BUILD	Mon Aug 03 11:26:30 2026 -0700
+++ b/mrjunejune/BUILD	Mon Aug 03 13:14:41 2026 -0700
@@ -1,5 +1,6 @@
 load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
 load("@rules_cc//cc:cc_library.bzl", "cc_library")
+load("@aspect_rules_js//js:defs.bzl", "js_library")
 load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
 load("//gui_ze:gui_ze.bzl", "move_files_into_dir", "bundle", "webp_image")
 
@@ -66,6 +67,26 @@
   ],
 )
 
+filegroup(
+  name = "sample_hls_mp4",
+  srcs = ["assets/video/sample_hls.mp4"],
+  visibility = [
+    "//mrjunejune:__pkg__",
+    "//third_party/ffmpeg:__pkg__",
+  ],
+)
+
+cc_binary(
+  name = "generate_hls_sample",
+  srcs = ["generate_hls_sample.c"],
+  args = [
+    "$(location :sample_hls_mp4)",
+    "mrjunejune/src/public/hls-sample",
+  ],
+  data = [":sample_hls_mp4"],
+  deps = ["//third_party/ffmpeg:ffmpeg_cli"],
+)
+
 move_files_into_dir(
   name = "generated_public_webp",
   srcs = [":generated_webp_assets"],
@@ -74,6 +95,12 @@
 
 # Files
 move_files_into_dir(
+    name = "hlsjs_runtime",
+    srcs = ["@hlsjs//:dist/hls.min.js"],
+    dest = "src/public",
+)
+
+move_files_into_dir(
   name = "react_pages",
   srcs = [
     "//react_games:games"
@@ -119,7 +146,7 @@
   srcs = glob(
     ["src/public/*"],
     exclude = ["src/public/*.png"],
-  ) + [":generated_public_webp"],
+  ) + [":generated_public_webp", ":hlsjs_runtime"],
   visibility = ["//visibility:public"],
 )
 
@@ -134,7 +161,13 @@
   srcs = glob(
     ["src/**"],
     exclude = ["src/**/*.png"],
-  ) + [":react_pages", ":shared_js_non_public", ":shared_js_file", ":rich_editor_js", ":icons", ":generated_public_webp"],
+  ) + [":react_pages", ":shared_js_non_public", ":shared_js_file", ":rich_editor_js", ":icons", ":generated_public_webp", ":hlsjs_runtime"],
+  visibility = ["//mrjunejune/test:__pkg__"],
+)
+
+js_library(
+  name = "hls_player_js",
+  srcs = ["src/tools/hls_player/hls-player.js"],
   visibility = ["//mrjunejune/test:__pkg__"],
 )