implement powerful viewer count system

This commit is contained in:
2026-05-16 23:38:35 +03:30
parent 95d14f2cec
commit 799581ee52
19 changed files with 762 additions and 17 deletions

View File

@@ -10,6 +10,8 @@ use Illuminate\Support\Str;
class MediaMtxService
{
public function __construct(private readonly ViewerCountStore $viewerCounts) {}
public function authorize(array $payload): bool
{
$action = (string) ($payload['action'] ?? '');
@@ -79,6 +81,8 @@ class MediaMtxService
'live_broadcast_id' => $broadcast->id,
])->save();
$this->viewerCounts->forget($channel);
return $broadcast;
}
@@ -107,6 +111,8 @@ class MediaMtxService
'live_broadcast_id' => null,
])->save();
$this->viewerCounts->forget($channel);
return $broadcast;
}