-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Uppy Companion Server - RTMP Server - Live Stream
- Loading branch information
Showing
26 changed files
with
3,743 additions
and
333 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace App\Http\Livewire\Frontend\Channel; | ||
|
||
use Livewire\Component; | ||
|
||
class LiveProducer extends Component | ||
{ | ||
public $channel_id; | ||
public $video_id; | ||
public $video; | ||
public $name; | ||
public $description; | ||
public $start; | ||
public $server_url; | ||
public $stream_key; | ||
|
||
public function mount() | ||
{ | ||
$this->video = auth()->user()->channels()->find($this->channel_id)->videos()->find($this->video_id); | ||
$this->name = $this->video->name; | ||
$this->description = $this->video->description; | ||
$this->start = $this->video->extra_attributes->get('go_live'); | ||
$this->stream_key = $this->video->extra_attributes->get('stream_key'); | ||
$this->server_url = env('RTMP_SERVER_URL'); | ||
} | ||
|
||
public function startLive($value) | ||
{ | ||
$this->video->extra_attributes->set('go_live', $value); | ||
$this->start = $value; | ||
|
||
$this->video->name = $this->name; | ||
$this->video->description = $this->description; | ||
$this->video->save(); | ||
|
||
$this->emit('startLive'); | ||
} | ||
|
||
public function render() | ||
{ | ||
return view('livewire.frontend.channel.live-producer'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
namespace App\Http\Livewire\Frontend\Channel\Modal; | ||
|
||
use App\Models\Channel\Channel; | ||
use Illuminate\Support\Str; | ||
use Livewire\Component; | ||
use Livewire\WithFileUploads; | ||
use LivewireUI\Modal\ModalComponent; | ||
|
||
class CreateStream extends ModalComponent | ||
{ | ||
use WithFileUploads; | ||
|
||
public $channel_id; | ||
public $name; | ||
public $description; | ||
public $photo; | ||
|
||
public static function closeModalOnClickAway(): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function render() | ||
{ | ||
return view('livewire.frontend.channel.modal.create-stream'); | ||
} | ||
|
||
public function submit() | ||
{ | ||
$stream_key = Str::random(20); | ||
$filesystem = config('site.converted_file_driver'); | ||
$streaming_url = "/live/{$stream_key}/index.m3u8"; | ||
$media_id = Str::random(10); | ||
|
||
$channel = Channel::find($this->channel_id); | ||
$video = $channel->videos()->create([ | ||
'name' => $this->name, | ||
'description' => $this->description, | ||
'disk' => $filesystem, | ||
'media_id' => $media_id, | ||
'status' => 'ready', | ||
'streaming_url' => $streaming_url, | ||
'type' => 'live', | ||
'extra_attributes' => [ | ||
'stream_key' => $stream_key, | ||
'go_live' => false | ||
] | ||
]); | ||
|
||
if ($this->photo) | ||
{ | ||
$this->photo->storeAs('converted/' . $video->media_id, $video->id . '.png', $video->disk); | ||
$video->thumbnail_url = "converted/{$video->media_id}/{$video->id}.png"; | ||
$video->save(); | ||
} | ||
|
||
$this->redirectRoute('user.channels.live', ['channel_id' => $video->channel_id, 'video_id' => $video->id]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
database/migrations/2021_08_03_123240_add_extra_attributes_column_to_videos_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class AddExtraAttributesColumnToVideosTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table('videos', function (Blueprint $table) { | ||
$table->string('scheduled_at')->nullable(); | ||
$table->string('type')->default('upload'); | ||
$table->schemalessAttributes('extra_attributes'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::table('videos', function (Blueprint $table) { | ||
$table->dropColumn('scheduled_at'); | ||
$table->dropColumn('type'); | ||
$table->dropColumn('extra_attributes'); | ||
}); | ||
} | ||
} |
Oops, something went wrong.