mirror of https://github.com/pixelfed/pixelfed
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
727 B
PHTML
33 lines
727 B
PHTML
3 years ago
|
<?php
|
||
|
|
||
|
namespace App\Models;
|
||
|
|
||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||
|
use Illuminate\Database\Eloquent\Model;
|
||
|
use Storage;
|
||
|
|
||
|
class LiveStream extends Model
|
||
|
{
|
||
|
use HasFactory;
|
||
|
|
||
|
public function getHlsUrl()
|
||
|
{
|
||
|
$path = Storage::url("live-hls/{$this->stream_id}/index.m3u8");
|
||
|
return url($path);
|
||
|
}
|
||
|
|
||
|
public function getStreamKeyUrl()
|
||
|
{
|
||
|
$proto = 'rtmp://';
|
||
|
$host = config('livestreaming.server.host');
|
||
|
$port = ':' . config('livestreaming.server.port');
|
||
|
$path = '/' . config('livestreaming.server.path') . '?';
|
||
|
$query = http_build_query([
|
||
|
'key' => $this->stream_key,
|
||
|
'ts' => time()
|
||
|
]);
|
||
|
|
||
|
return $proto . $host . $port . $path . $query;
|
||
|
}
|
||
|
}
|