Skip to content

Commit 040b44f

Browse files
committed
Big Bang
First Commit
0 parents  commit 040b44f

File tree

291 files changed

+238080
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

291 files changed

+238080
-0
lines changed

.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2

.env.example

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
APP_NAME=Laravel
2+
APP_ENV=local
3+
APP_KEY=
4+
APP_DEBUG=true
5+
APP_URL=http://localhost
6+
7+
LOG_CHANNEL=stack
8+
LOG_LEVEL=debug
9+
10+
DB_CONNECTION=mysql
11+
DB_HOST=127.0.0.1
12+
DB_PORT=3306
13+
DB_DATABASE=mtube
14+
DB_USERNAME=root
15+
DB_PASSWORD=
16+
17+
BROADCAST_DRIVER=log
18+
CACHE_DRIVER=file
19+
FILESYSTEM_DRIVER=local
20+
QUEUE_CONNECTION=sync
21+
SESSION_DRIVER=file
22+
SESSION_LIFETIME=120
23+
24+
MEMCACHED_HOST=127.0.0.1
25+
26+
REDIS_HOST=127.0.0.1
27+
REDIS_PASSWORD=null
28+
REDIS_PORT=6379
29+
30+
MAIL_MAILER=smtp
31+
MAIL_HOST=mailhog
32+
MAIL_PORT=1025
33+
MAIL_USERNAME=null
34+
MAIL_PASSWORD=null
35+
MAIL_ENCRYPTION=null
36+
MAIL_FROM_ADDRESS=null
37+
MAIL_FROM_NAME="${APP_NAME}"
38+
39+
AWS_ACCESS_KEY_ID=
40+
AWS_SECRET_ACCESS_KEY=
41+
AWS_DEFAULT_REGION=us-east-1
42+
AWS_BUCKET=
43+
AWS_USE_PATH_STYLE_ENDPOINT=false
44+
45+
PUSHER_APP_ID=
46+
PUSHER_APP_KEY=
47+
PUSHER_APP_SECRET=
48+
PUSHER_APP_CLUSTER=mt1
49+
50+
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
51+
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
52+
53+
LARAVEL_WEBSOCKETS_SSL_LOCAL_CERT=
54+
LARAVEL_WEBSOCKETS_SSL_LOCAL_PK=
55+
LARAVEL_WEBSOCKETS_SSL_PASSPHRASE=
56+
57+
FFMPEG_BINARIES="/usr/local/bin/ffmpeg"
58+
FFPROBE_BINARIES="/usr/local/bin/ffprobe"

.gitattributes

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
* text=auto
2+
*.css linguist-vendored
3+
*.scss linguist-vendored
4+
*.js linguist-vendored
5+
CHANGELOG.md export-ignore

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/node_modules
2+
/public/hot
3+
/public/storage
4+
/storage/*.key
5+
/vendor
6+
.env
7+
.env.backup
8+
.phpunit.result.cache
9+
docker-compose.override.yml
10+
Homestead.json
11+
Homestead.yaml
12+
npm-debug.log
13+
yarn-error.log
14+
/.idea
15+
/.vscode

.styleci.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
php:
2+
preset: laravel
3+
disabled:
4+
- no_unused_imports
5+
finder:
6+
not-name:
7+
- index.php
8+
- server.php
9+
js:
10+
finder:
11+
not-name:
12+
- webpack.mix.js
13+
css: true

README.md

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<p align="center">
2+
<img src="/images/logo.png" width="300">
3+
</p>
4+
5+
#mTube : Simple Video Sharing Platform
6+
7+
## About Laravel
8+
9+
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
10+
11+
- [Simple, fast routing engine](https://laravel.com/docs/routing).
12+
- [Powerful dependency injection container](https://laravel.com/docs/container).
13+
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
14+
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
15+
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
16+
- [Robust background job processing](https://laravel.com/docs/queues).
17+
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
18+
19+
Laravel is accessible, powerful, and provides tools required for large, robust applications.
20+
21+
## Learning Laravel
22+
23+
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
24+
25+
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
26+
27+
## Laravel Sponsors
28+
29+
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
30+
31+
### Premium Partners
32+
33+
- **[Vehikl](https://vehikl.com/)**
34+
- **[Tighten Co.](https://tighten.co)**
35+
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
36+
- **[64 Robots](https://64robots.com)**
37+
- **[Cubet Techno Labs](https://cubettech.com)**
38+
- **[Cyber-Duck](https://cyber-duck.co.uk)**
39+
- **[Many](https://www.many.co.uk)**
40+
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
41+
- **[DevSquad](https://devsquad.com)**
42+
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
43+
- **[OP.GG](https://op.gg)**
44+
45+
## Contributing
46+
47+
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
48+
49+
## Code of Conduct
50+
51+
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
52+
53+
## Security Vulnerabilities
54+
55+
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [[email protected]](mailto:[email protected]). All security vulnerabilities will be promptly addressed.
56+
57+
## License
58+
59+
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use App\Events\VideoProgress;
6+
use App\Models\Channel\Video;
7+
use FFMpeg\Format\Video\X264;
8+
use Illuminate\Console\Command;
9+
use ProtoneMedia\LaravelFFMpeg\Support\FFMpeg;
10+
11+
class ConvertVideoForStreaming extends Command
12+
{
13+
/**
14+
* The name and signature of the console command.
15+
*
16+
* @var string
17+
*/
18+
protected $signature = 'convert:hls {id}';
19+
20+
/**
21+
* The console command description.
22+
*
23+
* @var string
24+
*/
25+
protected $description = 'Convert Video For Streaming';
26+
27+
/**
28+
* Create a new command instance.
29+
*
30+
* @return void
31+
*/
32+
public function __construct()
33+
{
34+
parent::__construct();
35+
}
36+
37+
/**
38+
* Execute the console command.
39+
*/
40+
public function handle()
41+
{
42+
$video = Video::find($this->argument('id'));
43+
$video->update([
44+
'status' => 'notready'
45+
]);
46+
47+
$this->info("Converting {$video->name}");
48+
49+
$name = 'converted/' . $video->media_id . '/'. $video->id . '.m3u8';
50+
$thumbnail = 'converted/' . $video->media_id . '/'. $video->id . '.png';
51+
52+
try {
53+
$lowBitrate = (new X264)->setKiloBitrate(250);
54+
$midBitrate = (new X264)->setKiloBitrate(500);
55+
$highBitrate = (new X264)->setKiloBitrate(1000);
56+
$superBitrate = (new X264)->setKiloBitrate(1500);
57+
58+
$ffmpeg = FFMpeg::fromDisk('public')->open($video->path);
59+
$ffmpeg->exportForHLS()
60+
->setSegmentLength(config('site.hls_segment_size'))
61+
->addFormat($lowBitrate)
62+
->addFormat($midBitrate)
63+
->addFormat($highBitrate)
64+
->addFormat($superBitrate)
65+
->onProgress(function ($progress) use ($video) {
66+
$video->update([
67+
'progress' => $progress
68+
]);
69+
$this->info("Progress : {$progress}%");
70+
broadcast(new VideoProgress());
71+
})
72+
->toDisk($video->disk)
73+
->save($name)
74+
->getFrameFromSeconds(config('site.frame_from_seconds'))
75+
->export()
76+
->toDisk($video->disk)
77+
->save($thumbnail);
78+
79+
$video->update([
80+
'thumbnail_url' => $thumbnail,
81+
'streaming_url' => $name,
82+
'progress' => 100,
83+
'status' => 'ready'
84+
]);
85+
broadcast(new VideoProgress());
86+
$this->info('Done!!');
87+
}catch (\Exception $e) {
88+
$video->update([
89+
'status' => 'failed'
90+
]);
91+
}
92+
}
93+
}

app/Console/Kernel.php

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
namespace App\Console;
4+
5+
use Illuminate\Console\Scheduling\Schedule;
6+
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
7+
8+
class Kernel extends ConsoleKernel
9+
{
10+
/**
11+
* The Artisan commands provided by your application.
12+
*
13+
* @var array
14+
*/
15+
protected $commands = [
16+
//
17+
];
18+
19+
/**
20+
* Define the application's command schedule.
21+
*
22+
* @param \Illuminate\Console\Scheduling\Schedule $schedule
23+
* @return void
24+
*/
25+
protected function schedule(Schedule $schedule)
26+
{
27+
// $schedule->command('inspire')->hourly();
28+
}
29+
30+
/**
31+
* Register the commands for the application.
32+
*
33+
* @return void
34+
*/
35+
protected function commands()
36+
{
37+
$this->load(__DIR__.'/Commands');
38+
39+
require base_path('routes/console.php');
40+
}
41+
}

app/Events/VideoProgress.php

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
namespace App\Events;
4+
5+
use Illuminate\Broadcasting\Channel;
6+
use Illuminate\Broadcasting\InteractsWithSockets;
7+
use Illuminate\Broadcasting\PresenceChannel;
8+
use Illuminate\Broadcasting\PrivateChannel;
9+
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
10+
use Illuminate\Foundation\Events\Dispatchable;
11+
use Illuminate\Queue\SerializesModels;
12+
13+
class VideoProgress implements ShouldBroadcast
14+
{
15+
use Dispatchable, InteractsWithSockets, SerializesModels;
16+
17+
/**
18+
* Create a new event instance.
19+
*
20+
* @return void
21+
*/
22+
public function __construct()
23+
{
24+
//
25+
}
26+
27+
/**
28+
* Get the channels the event should broadcast on.
29+
*
30+
* @return \Illuminate\Broadcasting\Channel|array
31+
*/
32+
public function broadcastOn()
33+
{
34+
return new Channel('progress');
35+
}
36+
}

app/Exceptions/Handler.php

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
namespace App\Exceptions;
4+
5+
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
6+
use Throwable;
7+
8+
class Handler extends ExceptionHandler
9+
{
10+
/**
11+
* A list of the exception types that are not reported.
12+
*
13+
* @var array
14+
*/
15+
protected $dontReport = [
16+
//
17+
];
18+
19+
/**
20+
* A list of the inputs that are never flashed for validation exceptions.
21+
*
22+
* @var array
23+
*/
24+
protected $dontFlash = [
25+
'current_password',
26+
'password',
27+
'password_confirmation',
28+
];
29+
30+
/**
31+
* Register the exception handling callbacks for the application.
32+
*
33+
* @return void
34+
*/
35+
public function register()
36+
{
37+
$this->reportable(function (Throwable $e) {
38+
//
39+
});
40+
}
41+
}

0 commit comments

Comments
 (0)