Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue streaming file in a video html tag #763

Closed
L3o-pold opened this issue Oct 23, 2023 · 11 comments · Fixed by #842
Closed

Issue streaming file in a video html tag #763

L3o-pold opened this issue Oct 23, 2023 · 11 comments · Fixed by #842
Assignees

Comments

@L3o-pold
Copy link
Contributor

L3o-pold commented Oct 23, 2023

Octane Version

2.1.0

Laravel Version

10.28.0

PHP Version

8.2.10

What server type are you using?

Swoole

Server Version

5.0.3

Database Driver & Version

No response

Description

When using Swoole or Open swoole, streaming a video file (mp4 hevc) and trying to display it in a video html tag result in an empty video player.

Using the same code without Octane works as expected (video player displayed and able to play the video)

Steps To Reproduce

git clone https://github.com/L3o-pold/bug-report.git
php artisan octane:start

Open http://127.0.0.1:8000 on a Chrome browser.

image

Video fails to load with following error:

FFmpegDemuxer: open context failed
Error Group: PipelineStatus
Error Code: 12
Stacktrace: media/filters/ffmpeg_demuxer.cc:1256

Without Octane (php artisan serve) the video is playable without any issue

image
Copy link

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

@sy-records
Copy link
Contributor

@L3o-pold Modify the header to restore normal, you can try it.

Route::get('/video', function () {
    return response()->download(
        resource_path('videos/TSU_640x360.mp4'),
        null,
        ['Accept-Ranges' => null]
    );
});

This seems to be a swoole bug. Introduced by swoole/swoole-src@8e37910 cc @Yurunsoft @NathanFreeman

Duplicate of hyperf/hyperf#6223

@L3o-pold
Copy link
Contributor Author

@sy-records yes and no, without streaming, you are able to play the video, but you are not able to go forward or backward. Streaming is needed for this functionality.

@nunomaduro
Copy link
Member

We'll need more info and/or code to debug this further. Can you please create a repository with the command below, commit the code that reproduces the issue as one separate commit on the main/master branch and share the repository here?

Please make sure that you have the latest version of the Laravel installer in order to run this command. Please also make sure you have both Git & the GitHub CLI tool properly set up.

laravel new bug-report --github="--public"

Do not amend and create a separate commit with your custom changes. After you've posted the repository, we'll try to reproduce the issue.

Thanks!

@L3o-pold
Copy link
Contributor Author

L3o-pold commented Dec 19, 2023

It was provided in my first message: https://github.com/L3o-pold/bug-report.git but I guess it's an issue with Swoole and not Laravel Octane so feel free to close the issue.

@sy-records
Copy link
Contributor

@L3o-pold You can compile the master code for swoole-src to test it and see if it solves the problem.

@nunomaduro
Copy link
Member

it's an issue with Swoole and not Laravel Octane so feel free to close the issue.

@L3o-pold
Copy link
Contributor Author

@sy-records no change with Swoole 5.1.2 😞

@L3o-pold
Copy link
Contributor Author

L3o-pold commented Feb 8, 2024

I do not reproduce on Swoole 5.1.2 but still with Octane so it seems to be an issue with how file are streamed on the Octane side.

Headers seems identical with or without Octane so my only guess is that the issue is located in the binary response content.

The Swoole code used to test it.

$http = new Swoole\Http\Server(port: 9501);
$http->set([
    'log_file'                 => '/dev/null',
    'open_http2_protocol'      => true,
    'enable_static_handler'    => true,
    'document_root'            => '/var/www/static',
    'static_handler_locations' => ['/static', '/']
]);

$http->on('request', function (Swoole\Http\Request $request, Swoole\Http\Response $response) use ($http) {
    $response->end('ok');
});

$http->start();

@L3o-pold
Copy link
Contributor Author

L3o-pold commented Feb 8, 2024

@nunomaduro it seems to be related from this code https://github.com/laravel/octane/blob/2.x/src/Swoole/SwooleClient.php#L204

Offset param is missing

@L3o-pold
Copy link
Contributor Author

Can we reopen this as setting the offset param seems to fix the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants