Steady-Entertainment

Creator at Offline

Member Since 1 Year Ago

World

Experience Points
51,830
Total
Experience

3,170 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
467
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

  • Community Pillar

    Earned once your experience points ranks in the top 10 of all Laracasts users.

Level 11
51,830 XP
Jan
13
5 days ago
Activity icon

Replied to Laravel FFMPEG

hmmm thanks tray2 but that doesn't help :(

It used to work with the UploadFile facade but now something changes and I tried your way but that fails :(

Activity icon

Started a new Conversation Laravel FFMPEG

Hey guys this is another question about FFMPEG :)

I am getting the error encoding failed for a file which I generated with laravel facade UploadedFile

/** @test */

    public function can_upload_video()
    {

        $sizeInKilobytes = 100000;

        $file = UploadedFile::fake()->create(
            'video.mp4', $sizeInKilobytes, 'video/mp4'
        );

        Storage::fake('videos_disk');

        $this->actingAs(User::factory()->create());

        Livewire::test(Create::class)
            ->set('title', 'Testvideo333')
            ->set('video', $file)
            ->call('upload');

        dd(Storage::disk('videos_disk')->allFiles());
    }

If I upload real files it works and the files get transcoded to .m3u8 playlists

<?php

namespace App\Jobs;

use FFMpeg\Coordinate\Dimension;
use App\Models\Video;
use Carbon\Carbon;
use FFMpeg\Format\Video\X264;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use ProtoneMedia\LaravelFFMpeg\Support\FFMpeg;
use Illuminate\Support\Facades\Storage;

class ConvertVideoForStreaming implements ShouldQueue
{
 use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    public $video;

    /**
     * Create a new job instance.
     *
     * @param Video $video
     */
    public function __construct(Video $video)
    {
        $this->video = $video;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        $m3u8 = $this->video->id.'.m3u8';

        // create some video formats...
//        $lowBitrateFormat  = (new X264('aac', 'libx264'))->setKiloBitrate(500);
        $midBitrateFormat  = (new X264('aac'))->setKiloBitrate(1000);
//        $highBitrateFormat  = (new X264('aac'))->setKiloBitrate(3000);

        // open the uploaded video from the right disk...
        FFMpeg::fromDisk($this->video->disk)
            ->open($this->video->path)

        // call the 'exportForHLS' method and specify the disk to which we want to export...
            ->exportForHLS()
            ->toDisk('streamable_videos')

        // we'll add different formats so the stream will play smoothly
        // with all kinds of internet connections...
//            ->addFormat($lowBitrateFormat)
            ->addFormat($midBitrateFormat)
//            ->addFormat($highBitrateFormat)

        // call the 'save' method with a filename...
            ->save($m3u8);

        $streaming_path = secure_url('videos/'.$m3u8);
        // update the database so we know the convertion is done!
        $this->video->update([
            'converted_for_streaming_at' => Carbon::now(),
            'streaming_path' => $streaming_path,
        ]);
    }
}

but when I run the test I get the following error:

ProtoneMedia\LaravelFFMpeg\Exporters\EncodingException : Encoding failed
 /Users/reniar/code/OfflineJetstream/vendor/pbmedia/laravel-ffmpeg/src/Exporters/EncodingException.php:12
 /Users/reniar/code/OfflineJetstream/vendor/pbmedia/laravel-ffmpeg/src/Exporters/MediaExporter.php:171
 /Users/reniar/code/OfflineJetstream/vendor/pbmedia/laravel-ffmpeg/src/Exporters/MediaExporter.php:129
 /Users/reniar/code/OfflineJetstream/vendor/pbmedia/laravel-ffmpeg/src/Exporters/HLSExporter.php:174
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php:692
 /Users/reniar/code/OfflineJetstream/vendor/pbmedia/laravel-ffmpeg/src/Exporters/HLSExporter.php:184
 /Users/reniar/code/OfflineJetstream/app/Jobs/ConvertVideoForStreaming.php:63
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/Util.php:40
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:37
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/Container.php:610
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:128
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:128
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:132
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php:96
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:128
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php:98
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php:67
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php:98
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php:43
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:251
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:227
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:77
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesJobs.php:17
 /Users/reniar/code/OfflineJetstream/app/Http/Livewire/Create.php:40
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/Util.php:40
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:37
 /Users/reniar/code/OfflineJetstream/vendor/livewire/livewire/src/ComponentConcerns/HandlesActions.php:138
 /Users/reniar/code/OfflineJetstream/vendor/livewire/livewire/src/HydrationMiddleware/PerformActionCalls.php:19
 /Users/reniar/code/OfflineJetstream/vendor/livewire/livewire/src/LifecycleManager.php:70
 /Users/reniar/code/OfflineJetstream/vendor/livewire/livewire/src/Connection/ConnectionHandler.php:12
 /Users/reniar/code/OfflineJetstream/vendor/livewire/livewire/src/Controllers/HttpConnectionHandler.php:13
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php:48
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Routing/Route.php:254
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Routing/Route.php:197
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Routing/Router.php:692
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:128
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Routing/Router.php:694
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Routing/Router.php:669
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Routing/Router.php:635
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Routing/Router.php:624
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:166
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:128
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:141
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:110
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php:508
 /Users/reniar/code/OfflineJetstream/vendor/livewire/livewire/src/Testing/TestableLivewire.php:184
 /Users/reniar/code/OfflineJetstream/vendor/livewire/livewire/src/Testing/MakesHttpRequestsWrapper.php:29
 /Users/reniar/code/OfflineJetstream/vendor/livewire/livewire/src/Testing/TestableLivewire.php:185
 /Users/reniar/code/OfflineJetstream/vendor/livewire/livewire/src/Testing/TestableLivewire.php:173
 /Users/reniar/code/OfflineJetstream/vendor/livewire/livewire/src/Testing/Concerns/MakesCallsToComponent.php:134
 /Users/reniar/code/OfflineJetstream/vendor/livewire/livewire/src/Testing/Concerns/MakesCallsToComponent.php:36
 /Users/reniar/code/OfflineJetstream/vendor/livewire/livewire/src/Testing/Concerns/MakesCallsToComponent.php:30
 /Users/reniar/code/OfflineJetstream/tests/Feature/CreateTest.php:45
 
 Caused by
 Alchemy\BinaryDriver\Exception\ExecutionFailureException: ffmpeg failed to execute command '/usr/local/bin/ffmpeg' '-y' '-threads' '12' '-i' '/Users/reniar/code/OfflineJetstream/storage/framework/testing/disks/videos_disk/7KncBJNXbXPRQNlpZS5dbSUrTYJBJhGIAnJy4stt.mp4' '-map' '0' '-vcodec' 'libx264' '-b:v' '1000k' '-g' '48' '-hls_playlist_type' 'vod' '-hls_time' '10' '-hls_segment_filename' '/Users/reniar/code/OfflineJetstream/storage/app/streamable_videos/1_0_1000_%05d.ts' '-acodec' 'aac' '-b:a' '128k' '/Users/reniar/code/OfflineJetstream/storage/app/streamable_videos/1_0_1000.m3u8':
 
 Error Output:
 
  ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
   built with Apple clang version 12.0.0 (clang-1200.0.32.27)
   configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1_4 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
   libavutil      56. 51.100 / 56. 51.100
   libavcodec     58. 91.100 / 58. 91.100
   libavformat    58. 45.100 / 58. 45.100
   libavdevice    58. 10.100 / 58. 10.100
   libavfilter     7. 85.100 /  7. 85.100
   libavresample   4.  0.  0 /  4.  0.  0
   libswscale      5.  7.100 /  5.  7.100
   libswresample   3.  7.100 /  3.  7.100
   libpostproc    55.  7.100 / 55.  7.100
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd3ce809000] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible!
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd3ce809000] moov atom not found
 /Users/reniar/code/OfflineJetstream/storage/framework/testing/disks/videos_disk/7KncBJNXbXPRQNlpZS5dbSUrTYJBJhGIAnJy4stt.mp4: Invalid data found when processing input
 
 
 /Users/reniar/code/OfflineJetstream/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/ProcessRunner.php:95
 /Users/reniar/code/OfflineJetstream/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/ProcessRunner.php:73
 /Users/reniar/code/OfflineJetstream/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/AbstractBinary.php:207
 /Users/reniar/code/OfflineJetstream/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/AbstractBinary.php:136
 /Users/reniar/code/OfflineJetstream/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Media/AdvancedMedia.php:237
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php:23
 /Users/reniar/code/OfflineJetstream/vendor/pbmedia/laravel-ffmpeg/src/Drivers/PHPFFMpeg.php:175
 /Users/reniar/code/OfflineJetstream/vendor/pbmedia/laravel-ffmpeg/src/Exporters/MediaExporter.php:169
 /Users/reniar/code/OfflineJetstream/vendor/pbmedia/laravel-ffmpeg/src/Exporters/MediaExporter.php:129
 /Users/reniar/code/OfflineJetstream/vendor/pbmedia/laravel-ffmpeg/src/Exporters/HLSExporter.php:174
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php:692
 /Users/reniar/code/OfflineJetstream/vendor/pbmedia/laravel-ffmpeg/src/Exporters/HLSExporter.php:184
 /Users/reniar/code/OfflineJetstream/app/Jobs/ConvertVideoForStreaming.php:63
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/Util.php:40
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:37
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/Container.php:610
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:128
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:128
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:132
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php:96
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:128
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php:98
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php:67
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php:98
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php:43
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:251
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:227
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:77
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesJobs.php:17
 /Users/reniar/code/OfflineJetstream/app/Http/Livewire/Create.php:40
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/Util.php:40
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:37
 /Users/reniar/code/OfflineJetstream/vendor/livewire/livewire/src/ComponentConcerns/HandlesActions.php:138
 /Users/reniar/code/OfflineJetstream/vendor/livewire/livewire/src/HydrationMiddleware/PerformActionCalls.php:19
 /Users/reniar/code/OfflineJetstream/vendor/livewire/livewire/src/LifecycleManager.php:70
 /Users/reniar/code/OfflineJetstream/vendor/livewire/livewire/src/Connection/ConnectionHandler.php:12
 /Users/reniar/code/OfflineJetstream/vendor/livewire/livewire/src/Controllers/HttpConnectionHandler.php:13
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php:48
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Routing/Route.php:254
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Routing/Route.php:197
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Routing/Router.php:692
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:128
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Routing/Router.php:694
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Routing/Router.php:669
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Routing/Router.php:635
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Routing/Router.php:624
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:166
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:128
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:141
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:110
 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php:508
 /Users/reniar/code/OfflineJetstream/vendor/livewire/livewire/src/Testing/TestableLivewire.php:184
 /Users/reniar/code/OfflineJetstream/vendor/livewire/livewire/src/Testing/MakesHttpRequestsWrapper.php:29
 /Users/reniar/code/OfflineJetstream/vendor/livewire/livewire/src/Testing/TestableLivewire.php:185
 /Users/reniar/code/OfflineJetstream/vendor/livewire/livewire/src/Testing/TestableLivewire.php:173
 /Users/reniar/code/OfflineJetstream/vendor/livewire/livewire/src/Testing/Concerns/MakesCallsToComponent.php:134
 /Users/reniar/code/OfflineJetstream/vendor/livewire/livewire/src/Testing/Concerns/MakesCallsToComponent.php:36
 /Users/reniar/code/OfflineJetstream/vendor/livewire/livewire/src/Testing/Concerns/MakesCallsToComponent.php:30
 /Users/reniar/code/OfflineJetstream/tests/Feature/CreateTest.php:45
Jan
05
1 week ago
Activity icon

Replied to Laravel Livewire Video Upload Testing Not Working

I don't understand, why I am getting an empty array if i run my test

 public function can_upload_video()
    {
        $path = '/Users/reniar/code/OfflineJetstream/storage/app/videos/test.mp4';
        $file = new UploadedFile($path, 'video', 'video/mp4', 4, false);
        $file->name = 'video';

//        $sizeInKilobytes = 100000;
//        $file = UploadedFile::fake()->create(
//            'video.mp4', $sizeInKilobytes, 'video/mp4'
//        );

        Storage::fake('videos_disk');

        $this->actingAs(User::factory()->create());

        Livewire::test(Create::class)
//            ->set('title', 'Testvideo333')
            ->set('video', $file)
            ->call('upload');

        dd(Storage::disk('videos_disk')->allFiles());
    }
}

If instead I run it like this:

 public function can_upload_video()
    {
    //    $path = '/Users/reniar/code/OfflineJetstream/storage/app/videos/test.mp4';
    //    $file = new UploadedFile($path, 'video', 'video/mp4', 4, false);
    //    $file->name = 'video';

        $sizeInKilobytes = 100000;
        $file = UploadedFile::fake()->create(
            'video.mp4', $sizeInKilobytes, 'video/mp4'
        );

        Storage::fake('videos_disk');

        $this->actingAs(User::factory()->create());

        Livewire::test(Create::class)
            ->set('video', $file)
            ->call('upload');

        dd(Storage::disk('videos_disk')->allFiles());
    }
}

I am getting the correct output video.mp4

Activity icon

Replied to Laravel Livewire Video Upload Testing Not Working

Okay I chenged it to your way but there is a bug in the backend that prevents me from testing so I escalated to git issue

https://github.com/livewire/livewire/issues/2298

Activity icon

Replied to Laravel Livewire Video Upload Testing Not Working

  $path = '/storage/videos/test.mp4';
        $name = 'video';
        $file = new UploadedFile($path, $name, filesize($path), 'video/mp4', null, true);

this doesn't work

Activity icon

Replied to Laravel Livewire Video Upload Testing Not Working

How do I define the path? Is the root for a test the testdirectory or the public folder or application root?

Activity icon

Replied to Laravel Livewire Video Upload Testing Not Working

Thanks for your advice Tray2 it helped me a lot.

I think the problem is, that I was actually trying to transcode the faked video.

But it seems the faked video is actually just an empty container.

So now the test is passing and I know what I did wrong thanks a lot

Activity icon

Replied to Laravel Livewire Video Upload Testing Not Working

But that makes not too much sense, since I am using the application in my browser and I can upload .mp4 files and they get transcoded and saved in the database correctly

Activity icon

Replied to Laravel Livewire Video Upload Testing Not Working

problem seems to be here

->save($m3u8);
Activity icon

Replied to Laravel Livewire Video Upload Testing Not Working

<?php

namespace App\Jobs;

use FFMpeg\Coordinate\Dimension;
use App\Models\Video;
use Carbon\Carbon;
use FFMpeg\Format\Video\X264;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use ProtoneMedia\LaravelFFMpeg\Support\FFMpeg;
use Illuminate\Support\Facades\Storage;

class ConvertVideoForStreaming implements ShouldQueue
{
 use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    public $video;

    /**
     * Create a new job instance.
     *
     * @param Video $video
     */
    public function __construct(Video $video)
    {
        $this->video = $video;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        $m3u8 = $this->video->id . '.m3u8';

        // create some video formats...
//        $lowBitrateFormat  = (new X264('aac', 'libx264'))->setKiloBitrate(500);
//        $midBitrateFormat  = (new X264('aac', 'libx264'))->setKiloBitrate(1000);
        $highBitrateFormat  = (new X264('aac'))->setKiloBitrate(3000);

        // open the uploaded video from the right disk...
        FFMpeg::fromDisk($this->video->disk)
            ->open($this->video->path)

        // call the 'exportForHLS' method and specify the disk to which we want to export...
            ->exportForHLS()
            ->toDisk('streamable_videos')

        // we'll add different formats so the stream will play smoothly
        // with all kinds of internet connections...
//            ->addFormat($lowBitrateFormat)
//            ->addFormat($midBitrateFormat)
            ->addFormat($highBitrateFormat)

        // call the 'save' method with a filename...
            ->save($m3u8);

        $streaming_path = secure_url('videos/'.$m3u8);
        // update the database so we know the convertion is done!
        $this->video->update([
            'converted_for_streaming_at' => Carbon::now(),
            'streaming_path' => $streaming_path,
        ]);
    }
}
Activity icon

Replied to Laravel Livewire Video Upload Testing Not Working

I tried that before and when I change the mime type to this it will tell me encoding failed

Activity icon

Started a new Conversation Laravel Livewire Video Upload Testing Not Working

Hello community something is not working with my testing procedure in laravel.

I am trying to test video uploading.

The functionality works flawlessly but I still want to write a test for it (but it will not pass)

MY TEST:

public function can_upload_video()
    {
        $sizeInKilobytes = 100000;

        $file = UploadedFile::fake()->create(
            'video.mp4', $sizeInKilobytes, 'mp4'
        );

        Storage::fake('videos_disk');

        $this->actingAs(User::factory()->create());

        Livewire::test(Create::class)
            ->set('title', 'foo')
            ->set('video', $file)
            ->call('upload');

        dd(Storage::disk('videos_disk')->allFiles());
    }

MY LIVEWIRE CONTROLLER:

<?php

class Create extends Component
{
    use WithFileUploads;
    use DispatchesJobs;

    public $video;
    public $title,

    public function upload()
    {
        $this->validate([
            'title' => 'required',
            'video' => 'max:1000000|required|file|mimetypes:video/mp4,video/mpeg,video/x-matroska',
        ]);

        $video = Video::create([
            'disk'          => 'videos_disk',
            'original_name' => $this->video->getClientOriginalName(),
            'path'          => $this->video->store('/', 'videos_disk'),
            'streaming_path'=> null,
            'title'         => $this->title,
        ]);

        $this->dispatch(new ConvertVideoForStreaming($video));
    }
}

When I run the test it gives me an empty array.

Normally I expect that the test would give me an array containing the video stored in the upload method under the videos_disk.

Jan
02
2 weeks ago
Activity icon

Replied to Open .m3u8 Files With Video-js

video-js 7.0 can open m3u8 playlists and decide based on the bandwith which quality of the playlit to pick and loads only the sections inside the stream its called VHS video-http-streaming

Activity icon

Replied to Open .m3u8 Files With Video-js

I already managed to get it to work.

I just needed to reference the video-js scripts inside the blade view instead of insinde the head section.

I don't know why but now I have the youtube functionality I hoped for and it is working flawlessly

Jan
01
2 weeks ago
Activity icon

Replied to Open .m3u8 Files With Video-js

That is not an option.

It must be possible to play .m3u8 in the browser

Activity icon

Started a new Conversation Open .m3u8 Files With Video-js

Dear community I wish you a happy new year,

I have a question for you.

I converted my video to an .m3u8 file successfully and stored it on a public disk.

https://i.imgur.com/aAksvvg.png

Now I want to play the .m3u8 file in my browser using videos js

        <video
    id="my-video"
    class="video-js"
    controls
    preload="auto"
    width="640"
    height="264"
{{--    poster="MY_VIDEO_POSTER.jpg"--}}
    data-setup="{}"
  >
    <source src="/videos/17.m3u8" type="application/vnd.apple.mpegurl" />
{{--    <source src="MY_VIDEO.webm" type="video/webm" />--}}

  </video>

for some reason the video is not beeing played back.

I heared something about an extra package to install to make this functionality available but then it states that this VHS package would already be avilable out of the box with video-js 7.x

https://github.com/videojs/http-streaming

I am confused how I can make this work

Dec
18
1 month ago
Activity icon

Replied to Laravel FFMPeg

All my *.mp4 look like this

https://postimg.cc/mttdBgyx

Thanks for your advise I will check videohelp.com

it is strange all my mp4 videos are like that also the once without timecode

also I get another strnge error output sometimes

Alchemy\BinaryDriver\Exception\ExecutionFailureException: ffmpeg failed to execute command '/usr/local/bin/ffmpeg' '-y' '-i' '/Users/reniar/code/OfflineJetstream/storage/app/public/NgzQEAWIjvJUX9wn.mp4' '-threads' '12' '-vcodec' 'libx264' '-acodec' 'libmp3lame' '-b:v' '500k' '-refs' '6' '-coder' '1' '-sc_threshold' '40' '-flags' '+loop' '-me_range' '16' '-subq' '7' '-i_qfactor' '0.71' '-qcomp' '0.6' '-qdiff' '4' '-trellis' '1' '-b:a' '128k' '-vf' '[in]scale=960:540 [out]' '-pass' '1' '-passlogfile' '/var/folders/kd/979xg6nd0jq8xy3zyy812c_40000gn/T/ffmpeg-passes5fdc9a58242b5coh38/pass-5fdc9a582433b' '/Users/reniar/code/OfflineJetstream/storage/app/public/NgzQEAWIjvJUX9wn.mp4':

Error Output:

 ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with Apple clang version 12.0.0 (clang-1200.0.32.27)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1_4 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/reniar/code/OfflineJetstream/storage/app/public/NgzQEAWIjvJUX9wn.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41isomavc1
    creation_time   : 2015-08-07T09:13:36.000000Z
  Duration: 00:00:30.53, start: 0.000000, bitrate: 4675 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 4486 kb/s, 30 fps, 30 tbr, 30 tbn, 60 tbc (default)
    Metadata:
      creation_time   : 2015-08-07T09:13:36.000000Z
      handler_name    : L-SMASH Video Handler
      encoder         : AVC Coding
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
    Metadata:
      creation_time   : 2015-08-07T09:13:36.000000Z
      handler_name    : L-SMASH Audio Handler
Output /Users/reniar/code/OfflineJetstream/storage/app/public/NgzQEAWIjvJUX9wn.mp4 same as Input #0 - exiting
FFmpeg cannot edit existing files in-place.
 in /Users/reniar/code/OfflineJetstream/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/ProcessRunner.php:95
Stack trace:
#0 /Users/reniar/code/OfflineJetstream/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/ProcessRunner.php(73): Alchemy\BinaryDriver\ProcessRunner->doExecutionFailure(''/usr/local/bin...', 'ffmpeg version ...')
#1 /Users/reniar/code/OfflineJetstream/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/AbstractBinary.php(207): Alchemy\BinaryDriver\ProcessRunner->run(Object(Symfony\Component\Process\Process), Object(SplObjectStorage), false)
#2 /Users/reniar/code/OfflineJetstream/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/AbstractBinary.php(136): Alchemy\BinaryDriver\AbstractBinary->run(Object(Symfony\Component\Process\Process), false, Array)
#3 /Users/reniar/code/OfflineJetstream/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Media/AbstractVideo.php(96): Alchemy\BinaryDriver\AbstractBinary->command(Array, false, Array)
#4 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php(23): FFMpeg\Media\AbstractVideo->save(Object(FFMpeg\Format\Video\X264), '/Users/reniar/c...')
#5 /Users/reniar/code/OfflineJetstream/vendor/pbmedia/laravel-ffmpeg/src/Drivers/PHPFFMpeg.php(175): ProtoneMedia\LaravelFFMpeg\Drivers\PHPFFMpeg->forwardCallTo(Object(ProtoneMedia\LaravelFFMpeg\FFMpeg\VideoMedia), 'save', Array)
#6 /Users/reniar/code/OfflineJetstream/vendor/pbmedia/laravel-ffmpeg/src/Exporters/MediaExporter.php(146): ProtoneMedia\LaravelFFMpeg\Drivers\PHPFFMpeg->__call('save', Array)
#7 /Users/reniar/code/OfflineJetstream/app/Jobs/ConvertVideoForStreaming.php(62): ProtoneMedia\LaravelFFMpeg\Exporters\MediaExporter->save('NgzQEAWIjvJUX9w...')
#8 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Jobs\ConvertVideoForStreaming->handle()
#9 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#10 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#11 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#12 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#13 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\Container\Container->call(Array)
#14 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(App\Jobs\ConvertVideoForStreaming))
#15 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(App\Jobs\ConvertVideoForStreaming))
#16 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#17 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(96): Illuminate\Bus\Dispatcher->dispatchNow(Object(App\Jobs\ConvertVideoForStreaming), false)
#18 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Queue\CallQueuedHandler->Illuminate\Queue\{closure}(Object(App\Jobs\ConvertVideoForStreaming))
#19 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(App\Jobs\ConvertVideoForStreaming))
#20 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(98): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#21 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(67): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware(Object(Illuminate\Queue\Jobs\DatabaseJob), Object(App\Jobs\ConvertVideoForStreaming))
#22 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\DatabaseJob), Array)
#23 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(406): Illuminate\Queue\Jobs\Job->fire()
#24 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(356): Illuminate\Queue\Worker->process('database', Object(Illuminate\Queue\Jobs\DatabaseJob), Object(Illuminate\Queue\WorkerOptions))
#25 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(158): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\DatabaseJob), 'database', Object(Illuminate\Queue\WorkerOptions))
#26 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(116): Illuminate\Queue\Worker->daemon('database', 'default', Object(Illuminate\Queue\WorkerOptions))
#27 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(100): Illuminate\Queue\Console\WorkCommand->runWorker('database', 'default')
#28 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Queue\Console\WorkCommand->handle()
#29 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#30 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#31 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#32 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#33 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call(Array)
#34 /Users/reniar/code/OfflineJetstream/vendor/symfony/console/Command/Command.php(255): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#35 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#36 /Users/reniar/code/OfflineJetstream/vendor/symfony/console/Application.php(971): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#37 /Users/reniar/code/OfflineJetstream/vendor/symfony/console/Application.php(290): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#38 /Users/reniar/code/OfflineJetstream/vendor/symfony/console/Application.php(166): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#39 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#40 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#41 /Users/reniar/code/OfflineJetstream/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#42 {main}

Next ProtoneMedia\LaravelFFMpeg\Exporters\EncodingException: Encoding failed in /Users/reniar/code/OfflineJetstream/vendor/pbmedia/laravel-ffmpeg/src/Exporters/EncodingException.php:12
Stack trace:
#0 /Users/reniar/code/OfflineJetstream/vendor/pbmedia/laravel-ffmpeg/src/Exporters/MediaExporter.php(149): ProtoneMedia\LaravelFFMpeg\Exporters\EncodingException::decorate(Object(FFMpeg\Exception\RuntimeException))
#1 /Users/reniar/code/OfflineJetstream/app/Jobs/ConvertVideoForStreaming.php(62): ProtoneMedia\LaravelFFMpeg\Exporters\MediaExporter->save('NgzQEAWIjvJUX9w...')
#2 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Jobs\ConvertVideoForStreaming->handle()
#3 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#4 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#5 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#6 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#7 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\Container\Container->call(Array)
#8 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(App\Jobs\ConvertVideoForStreaming))
#9 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(App\Jobs\ConvertVideoForStreaming))
#10 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#11 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(96): Illuminate\Bus\Dispatcher->dispatchNow(Object(App\Jobs\ConvertVideoForStreaming), false)
#12 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Queue\CallQueuedHandler->Illuminate\Queue\{closure}(Object(App\Jobs\ConvertVideoForStreaming))
#13 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(App\Jobs\ConvertVideoForStreaming))
#14 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(98): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#15 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(67): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware(Object(Illuminate\Queue\Jobs\DatabaseJob), Object(App\Jobs\ConvertVideoForStreaming))
#16 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\DatabaseJob), Array)
#17 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(406): Illuminate\Queue\Jobs\Job->fire()
#18 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(356): Illuminate\Queue\Worker->process('database', Object(Illuminate\Queue\Jobs\DatabaseJob), Object(Illuminate\Queue\WorkerOptions))
#19 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(158): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\DatabaseJob), 'database', Object(Illuminate\Queue\WorkerOptions))
#20 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(116): Illuminate\Queue\Worker->daemon('database', 'default', Object(Illuminate\Queue\WorkerOptions))
#21 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(100): Illuminate\Queue\Console\WorkCommand->runWorker('database', 'default')
#22 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Queue\Console\WorkCommand->handle()
#23 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#24 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#25 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#26 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#27 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call(Array)
#28 /Users/reniar/code/OfflineJetstream/vendor/symfony/console/Command/Command.php(255): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#29 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#30 /Users/reniar/code/OfflineJetstream/vendor/symfony/console/Application.php(971): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#31 /Users/reniar/code/OfflineJetstream/vendor/symfony/console/Application.php(290): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#32 /Users/reniar/code/OfflineJetstream/vendor/symfony/console/Application.php(166): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#33 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#34 /Users/reniar/code/OfflineJetstream/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#35 /Users/reniar/code/OfflineJetstream/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#36 {main}
Dec
17
1 month ago
Activity icon

Replied to Laravel FFMPeg

Good morning. All my *.mp4 videos are the same. As a codec they have:

H264, aac, timecode

Other .mp4 that have

H264, aac

Work

But videos with Timecode Codec on it don’t.

They will stop at frame 0 and be very pixeld

Dec
16
1 month ago
Activity icon

Replied to Laravel FFMPeg

to make it short ... this doesnt work :(

Activity icon

Replied to Laravel FFMPeg

I don't understand this it says

//or

So should I replace one with the other?

Activity icon

Replied to Laravel FFMPeg

Let me rephrase my question: How do I convert a video with a timecode on it?

Activity icon

Replied to Laravel FFMPeg

the previous video which did not work was

Timecode, AAC, H.264

and the command had

D  aac             raw ADTS AAC (Advanced Audio Coding)

as output

also

 DE h264            raw H.264 video

was there

but there is no timecode

Activity icon

Replied to Laravel FFMPeg

I found the mistake I did and it works now ...

When I upload a *.mp4 file it just takes the first frame and makes it pixeled and returns 0 seconds

But

when I upload a *.mkv

it correctly converts the file

Obviously my next question would be ...

How can I transfer any file to the same format X264?

Activity icon

Started a new Conversation Laravel FFMPeg

My videos are converted but they only show the first frame pixeld and zero seconds long

apparently there is some sort of time code on the videos

probably because they are shot with a go pro which is stabilizing the picture

<?php

namespace App\Jobs;

use FFMpeg\Coordinate\Dimension;
use app\models\video;
use Carbon\Carbon;
use FFMpeg\Filters\Video\VideoFilters;
use FFMpeg\Format\Video\X264;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use ProtoneMedia\LaravelFFMpeg\Support\FFMpeg;

class ConvertVideoForStreaming implements ShouldQueue
{
 use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    public $video;

    /**
     * Create a new job instance.
     *
     * @param Video $video
     */
    public function __construct(Video $video)
    {
        $this->video = $video;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        // create a video format...
        $lowBitrateFormat = (new X264('aac'))->setKiloBitrate(500);

        $converted_name = $this->getCleanFileName($this->video->path);

        // open the uploaded video from the right disk...
        FFMpeg::fromDisk($this->video->disk)
            ->open($this->video->path)

            // add the 'resize' filter...
            ->addFilter(function (VideoFilters $filters) {
                $filters->resize(new Dimension(640, 480));
            })

            // call the 'export' method...
            ->export()

            // tell the MediaExporter to which disk and in which format we want to export...
            ->toDisk('public')
            ->inFormat($lowBitrateFormat)

            // call the 'save' method with a filename...
            ->save($converted_name);

        // update the database so we know the convertion is done!
        $this->video->update([
            'converted_for_streaming_at' => Carbon::now(),
            'processed' => true,
            'stream_path' => $converted_name
        ]);
    }

    private function getCleanFileName($filename){
        return preg_replace('/\.[^.\s]{3,4}$/', '', $filename) . '.mp4';
    }
}

<?php

namespace App\Http\Controllers;

use App\Http\Requests\StoreVideoRequest;
use App\Jobs\ConvertVideoForStreaming;
use App\Models\Video;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use Livewire\Component;

class VideoController extends Controller
{
     /**
     * Return video blade view and pass videos to it.
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function index()
    {
        $videos = Video::orderBy('created_at', 'DESC')->get();
        return view('videos')->with('videos', $videos);
    }

    /**
     * Return uploader form view for uploading videos
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function uploader(){
        return view('uploader');
    }

    /**
     * Handles form submission after uploader form submits
     * @param StoreVideoRequest $request
     * @return \Illuminate\Http\RedirectResponse
     */
    public function store(StoreVideoRequest $request)
    {
        $path = Str::random(16) . '.' . $request->video->getClientOriginalExtension();
        $request->video->storeAs('public', $path);

        $video = Video::create([
            'disk'          => 'public',
            'original_name' => $request->video->getClientOriginalName(),
            'path'          => $path,
            'title'         => $request->title,
        ]);

        ConvertVideoForStreaming::dispatch($video);

        return redirect('/uploader')
            ->with(
                'message',
                'Your video will be available shortly after we process it'
            );
    }
}

how can I import FFMpeg directly into my projects?

use FFMpeg;
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Video extends Model
{
    use HasFactory;

    protected $dates = [
        'converted_for_streaming_at',
    ];

    protected $guarded = [];
    /**
     * @var mixed
     */
}
Dec
09
1 month ago
Activity icon

Replied to 413 Request Entity Too Large Nginx/1.19.0

apparently it is not enought o just restart php and nginx with valet but you have to restart computer dont know why

Activity icon

Awarded Best Reply on 413 Request Entity Too Large Nginx/1.19.0

restarting the computer and it worked

Activity icon

Replied to 413 Request Entity Too Large Nginx/1.19.0

restarting the computer and it worked

Activity icon

Started a new Conversation 413 Request Entity Too Large Nginx/1.19.0

Hello guys,

I get this error when I try to upload a 250mb big file

my php() info is configured correctly

upload_max_filesize	2000M	2000M

post_max_size	2000M	2000M

I also configured my nginx

sudo vim /usr/local/etc/nginx/nginx.conf
 client_max_body_size 512M;

i also chnaged the

/usr/local/etc/php/8.0/conf.d/php-memory-limits.ini

I also went to

~/.config/valet/Nginx

and changed my site specific config to:

 client_max_body_size 2000M;

I think valet might have a per site definition

but i could not find the correct place to adjeust this configuration

any ideas are welcome

I did all of this

https://www.dorelljames.com/blog/laravel-valet-increase-max-upload-file-size/

Dec
05
1 month ago
Activity icon

Replied to Jetstream Session Errors

I have to hit refresh exactly 3 times and it works again every morning when I wake up and go to a jetstream application exactly 3 times it changes the session ID 3 times and then it works ...

Activity icon

Replied to Jetstream Session Errors

Okay thank you but anyways the problem is back in business ...

~/reniar/code/OfflineJetstream/
Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] Connection refused (SQL: select * from `sessions` where `id` = 4m7cXbjFonKGSFlIbXSsopA2h7c9fZoHoofZ5bGQ limit 1)
http://offlinejetstream.test/user/profile
Dec
04
1 month ago
Activity icon

Replied to Jetstream Session Errors

I think you were right in the end ... I never experienced the bug again ... I think there was something unrelated to jetstream ...

mea culpa :D

Activity icon

Replied to Jetstream Session Errors

Hey Snapey :)

I posted it under feedback and that is my user experience.

I mean I didn't even start to work on it.

I just did a fresh install again.

Now the bug happens from time to time and then disappears.

If you think that my feedback is misguiding I would be more than happy if you could guid me in the right direction.

Any ideas or hints are welcome but I am still stepping in the dark about this.

I will investigate further (I think it has something to do when you get logged out automatically and your user session is still in the database).

When I find out how to reproduce the bug exactly I will make an issue on git hub.

If I am wrong and it is not a bug than I would love to find the solution.

Thx for your answer anyways

https://i.imgur.com/QwPw4yE.png

Dec
03
1 month ago
Activity icon

Replied to Base Table Or View Not Found: 1146 Table 'livewire.sessions' Doesn't Exist (SQL: Select * From `sessions` Where `id` = 3oAGmLOZ5IYz ...

Thanks I found the problem was connected to jet stream which I installed into my livewire project which is not recommended

Activity icon

Started a new Conversation Jetstream Session Errors

~/reniar/code/OfflineJetstream/
Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] Connection refused (SQL: select * from `sessions` where `id` = BVmwk1y0yP3VqLBaRqUAvUGfdRxqEd0f6EuQh87a limit 1)
http://offlinejetstream.test/

I think currently jetstream has some issues with sessions and livewire.session

this is the seconds post of me today regarding this topic.

First time is installed jetstream into an existing livewire project and that installed all the jetstream magic into the project

  • composer require laravel/jetstream - inside an existing livewire project. (not recommended at all)

solution for the first scenario

kill the project start from scratch and manually migrate MVC

The second time I made a jetstream application from scratch and just tweaked minor front end stuff the only files i tweaked were the following blade files as you can see on my gs (git status)

	modified:   resources/views/vendor/jetstream/components/application-logo.blade.php
	modified:   resources/views/vendor/jetstream/components/authentication-card-logo.blade.php
	modified:   resources/views/vendor/jetstream/components/authentication-card.blade.php

Without doing anything to that fresh application no commands on the command line nothing on other applications jetstream destroyed itself again

is there some sort of self destruction magic that I am not aware of?

solution for this scenario

was

-mfs (php artisan migrate:fresh)

Conclusion:

In my experience jetstream has issues with its sessions and is there fore unstable atm

https://laracasts.com/discuss/channels/livewire/base-table-or-view-not-found-1146-table-livewiresessions-doesnt-exist-sql-select-from-sessions-where-id-3oagmloz5iyz

Activity icon

Started a new Conversation Base Table Or View Not Found: 1146 Table 'livewire.sessions' Doesn't Exist (SQL: Select * From `sessions` Where `id` = 3oAGmLOZ5IYz ...

I don't even know where to start ...

the error appeared at some point when I was making tests and migrations for another model

I never knew I had a table called livewire.sessions

and yes I am using livewire

Illuminate\Database\QueryException SQLSTATE[42S02]: Base table or view not found: 1146 Table 'livewire.sessions' doesn't exist (SQL: select * from `sessions` where `id` = 3oAGmLOZ5IYztxiYFnkRiYIR4aBL6b48YUaAuI9a limit 1) http://livewiretest.test/

https://imgur.com/3RdO460

Activity icon

Replied to Test Fails On Member Function Null

SOLVED by writing a different test approach thanks

Activity icon

Replied to Test Fails On Member Function Null

yes definitively

all my other tests are passing maybe the only difference is that this test is inside the unit folder and I made it with the make:test -u and I am using livewire .... but I am not sure if that helps

<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
         bootstrap="vendor/autoload.php"
         colors="true"
>
    <testsuites>
        <testsuite name="Unit">
            <directory suffix="Test.php">./tests/Unit</directory>
        </testsuite>
        <testsuite name="Feature">
            <directory suffix="Test.php">./tests/Feature</directory>
        </testsuite>
    </testsuites>
    <coverage processUncoveredFiles="true">
        <include>
            <directory suffix=".php">./app</directory>
        </include>
    </coverage>
    <php>
        <server name="APP_ENV" value="testing"/>
        <server name="BCRYPT_ROUNDS" value="4"/>
        <server name="CACHE_DRIVER" value="array"/>
         <server name="DB_CONNECTION" value="sqlite"/>
         <server name="DB_DATABASE" value=":memory:"/>
        <server name="MAIL_MAILER" value="array"/>
        <server name="QUEUE_CONNECTION" value="sync"/>
        <server name="SESSION_DRIVER" value="array"/>
        <server name="TELESCOPE_ENABLED" value="false"/>
    </php>
</phpunit>

Activity icon

Started a new Conversation Laracast Under Heavy Load

When I try to open latschst from my laptop or desktop PC i get „the website is currently under heavy load“ please try again alter since many hours

With my mobile phone Incan join anyways ....

Activity icon

Started a new Conversation Test Fails On Member Function Null

Good morning friends

this time I have a easy one for you but I am not experienced enough to track the bug ...

I get the following error:

Error : Call to a member function connection() on null
<?php

namespace Tests\Unit;

use App\Models\Offer;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use PHPUnit\Framework\TestCase;

class OfferTest extends TestCase
{
    use RefreshDatabase;

//   protected $offer;

//    public function setUp(): void
//    {
//        parent::setUp(); // TODO: Change the autogenerated stub
//        $this->offer = Offer::factory()->create();
//    }

    /** @test */
    function an_offer_has_a_creator()
    {
        $offer = Offer::factory()->create();
        $offer->assertInstanceOf(User::class, $this->offer->user);
    }

}
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateOffersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('offers', function (Blueprint $table) {
            $table->id();

            $table->unsignedBigInteger('user_id');
            $table->foreign('user_id')->references('id')->on('users');
            $table->string('Name');

            $table->decimal('latitude', 8, 6);
            $table->decimal('longitude', 9, 6);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('offers');
    }
}
<?php

namespace Database\Factories;

use App\Models\Offer;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;

class OfferFactory extends Factory
{
    /**
     * The name of the factory's corresponding model.
     *
     * @var string
     */
    protected $model = Offer::class;

    public function definition ()
    {
        return [
            'Name' => 'Breath Work',

            'latitude' => 51.567952 ,
            'longitude' => 8.080428 ,
        ];
    }
}

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Offer extends Model
{
    use HasFactory;

public function user()
    {
        return $this->belongsTo(User::class);
    }
}

also a side question ... ist the without exception handling not done anymore?

Dec
02
1 month ago
Activity icon

Awarded Best Reply on Adding Icon As Marker

I really don't know what did the trick but I changed the tile provider and I changed some variable types from const to var and the other way around

I really don't know what was wrong before but now its working seamlessly :D

https://i.imgur.com/deLQOwC.png

{{--<img src={{ URL::asset('/images/iss.png') }} alt="">--}}
<div
    id="mapid"
    class="h-screen"
></div >

@push('head-scripts')

    <script
        src="https://unpkg.com/[email protected]/dist/leaflet.js"
        integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
        crossorigin=""
    >
    </script >

@endpush

<script >
          lat = 22;
          lon = 22;
          const mymap = L.map('mapid').setView([lat, lon], 3);


          var redcircle = L.circle([51.508, -0.11], {
              color: 'red',
              fillColor: '#f03',
              fillOpacity: 0.5,
              radius: 500
          }).addTo(mymap);

          var myIcon = L.icon({
              iconUrl: 'http://livewiretest.test/images/donut.png',
              iconSize: [38, 95],
              iconAnchor: [22, 94],
          });

          L.marker([50.505, 30.57], {icon: myIcon}).addTo(mymap);

          const tileUrl = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
          const tiles = L.tileLayer(tileUrl);
          tiles.addTo(mymap);


          // const marker = L.marker([lat, lon]).addTo(mymap);

    </script >
Activity icon

Replied to Adding Icon As Marker

I really don't know what did the trick but I changed the tile provider and I changed some variable types from const to var and the other way around

I really don't know what was wrong before but now its working seamlessly :D

https://i.imgur.com/deLQOwC.png

{{--<img src={{ URL::asset('/images/iss.png') }} alt="">--}}
<div
    id="mapid"
    class="h-screen"
></div >

@push('head-scripts')

    <script
        src="https://unpkg.com/[email protected]/dist/leaflet.js"
        integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
        crossorigin=""
    >
    </script >

@endpush

<script >
          lat = 22;
          lon = 22;
          const mymap = L.map('mapid').setView([lat, lon], 3);


          var redcircle = L.circle([51.508, -0.11], {
              color: 'red',
              fillColor: '#f03',
              fillOpacity: 0.5,
              radius: 500
          }).addTo(mymap);

          var myIcon = L.icon({
              iconUrl: 'http://livewiretest.test/images/donut.png',
              iconSize: [38, 95],
              iconAnchor: [22, 94],
          });

          L.marker([50.505, 30.57], {icon: myIcon}).addTo(mymap);

          const tileUrl = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
          const tiles = L.tileLayer(tileUrl);
          tiles.addTo(mymap);


          // const marker = L.marker([lat, lon]).addTo(mymap);

    </script >
Activity icon

Replied to Adding Icon As Marker

<div
    id="mapid"
    class="h-screen w-full z-0"
></div >

@push('head-scripts')

    <script
        src="https://unpkg.com/[email protected]/dist/leaflet.js"
        integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
        crossorigin=""
    >
    </script>

@endpush

    <script>

    //Making map and tiles
    const mymap = L.map('mapid').setView([0, 0], 3);

    L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
        maxZoom: 18,
        id: 'mapbox/streets-v11',
        tileSize: 512,
        zoomOffset: -1,
        accessToken: 'pk.eyJ1IjoicmVuaXIiLCJhIjoiY2toMW54eXF4MDlwZjJybmFoem5zaHoyOCJ9.vMLPuxo_2duOAym6w5q8rg'
    }).addTo(mymap);

    const iss = 'http://livewiretest.test/images/iss.png';

    const offline = L.icon({
        iconUrl: iss,
        iconSize: [50, 32], // size of the icon
        iconAnchor: [22, 16], // point of the icon which will correspond to marker's location
    });

    const marker = L.marker([0, 0, {icon: offline}]).addTo(mymap);


    marker.setLatLng([50, 20]);

</script >

Activity icon

Replied to Adding Icon As Marker

yes I did but I couldn't solve it

Activity icon

Replied to Adding Icon As Marker

I don't have anyone who pays me I just do it for everybody.

The idea is to have a platform where you can add offers.

The offers have a location and you can offer something for free or you can ask for something in exchange.

You can mark your offer on the map and other people can so find local offers.

The project is called offline and I am unfortunately working on it alone (at least from the programming) there are a lot of people who want to share content as it should also allow to upload videos that explain the offers.

Then you have a rating system where people can rate the interaction when an offer is completed so you will have a rating for the offers you exchanged and become a master (level system in your area)

Also there is 100 coins that everybody can receive when he/she joins the system and you can trade the coins with each other but you cannot buy the coins.

My idea is to have livewire or jetstream and laravel as back end to have EsXi as scalable servers and to use leaflet for maps and FFMPEG and the laravel/FFMEP package for the video upload and a basic forum and rating and tagging system for the offers....

I know that is a very hard project to do that is why I am learning programming since 2 years but always I run into problems that stop me for days or weeks and this forum has been the greatest repository of help especially with snappy and sinnbeck or you and others.

If I would be as good in programming as you guys are I would have finished it many months ago :D

But I don't know people who are as good in programming as you are and want to work on such a project.

Normal people always want to get paid and I just work for fun not for money :D.

Activity icon

Replied to Adding Icon As Marker

i meant strange that it works like that with you and at my site I am experiencing that problem

I am still wondering about this problem :D maybe it will cost me days to solve :D

how would you go if you experience a problem that you cannot solve at the moment?

Just work on another part and come back later?

Dec
01
1 month ago
Activity icon

Replied to Adding Icon As Marker

Is that inside a blade file?

Activity icon

Replied to Adding Icon As Marker

Hmmm that is really strange ....

Activity icon

Replied to Adding Icon As Marker

basic tests

1, Put what you think the url should be in your browser address bar. If the icon does not appear, don't bother going any further until you find out why your web server cannot serve a static image. At this point this IS NOT a javascript or Laravel issue.

it works http://livewiretest.test/images/iss.png no problem

2, Assuming you know the correct url for the icon, put it in your code. Hard code it. Not asset, not URL helper, just the raw URI

if I do

const iss = 'http://livewiretest.test/images/iss.png';

    const offline = L.icon({
        iconUrl: iss,
        iconSize: [50, 32], // size of the icon
        iconAnchor: [22, 16], // point of the icon which will correspond to marker's location
    });

that doesn't work and has the same effect like

const iss = '{{ URL::asset('/images/test.png') }}';

const offline = L.icon({
    iconUrl: iss,
    iconSize: [50, 32], // size of the icon
    iconAnchor: [22, 16], // point of the icon which will correspond to marker's location
});

Open the browser network tools. Refresh the page. See the assets being loaded. Look for the name of your file. Is it found and loaded? If it is in red then it was not found. Check the url being requested. Does it match the path that you think the image is located at? Is the image listed? if it is not even in the list of assets loaded then there is a javascript issue where your request to change the icon is not even considered.

Yes the image is not even listed but instead the standard image this blue standard marker is being pulled in via cdn

If the browser network tools are new to you, step back for a moment and watch some tutorials on how to use them. They will be used over and over so is a key skill for a web developer.