CodeIgniter Forums
MP4 Formatter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forum-30.html)
+--- Thread: MP4 Formatter (/thread-71374.html)



MP4 Formatter - Msobomvu - 08-07-2018

I am trying to playback HTML5 video using very basic HTML5 <video> tag via controller, but C4 seems to be blocking playback.  Appears to be looking for an MP4Formatter.  Started out using video.js and thought the player was at fault but since then I've tried others and resorted to plain html5.  Nothing plays.  Not sure how to overcome this one. Been driving me crazy. 

Also tried placing the basic html code at the top of the FCPATH/index.php before C4 actually initiates, but same result.  So, I suspected Apache and added mime type to .htaccess as follows:


<IfModule mod_mime.c>
    AddCharset utf-8 .atom .css .js .json .rss .vtt .xml .mp4
    AddType video/mp4 .mp4
</IfModule>

No joy.


Here is html:

<video width="320" height="240" controls>
  <source src="video/video.mp4" type="video/mp4">
</video>

Here's the error log:

CRITICAL - 2018-08-07 16:51:41 --> Uncaught InvalidArgumentException: No Formatter defined for mime type:  in D:\devserver\sites\www\web\app_my.domain.org\Config\Format.php:60
Stack trace:
#0 D:\devserver\sites\www\web\system\API\ResponseTrait.php(357): Config\Format->getFormatter('')
#1 D:\devserver\sites\www\web\system\API\ResponseTrait.php(120): CodeIgniter\Debug\Exceptions->format(Array)
#2 D:\devserver\sites\www\web\system\Debug\Exceptions.php(148): CodeIgniter\Debug\Exceptions->respond(Array, 404)
#3 [internal function]: CodeIgniter\Debug\Exceptions->exceptionHandler(Object(CodeIgniter\Exceptions\PageNotFoundException))
#4 {main}
  thrown
#0 [internal function]: CodeIgniter\Debug\Exceptions->shutdownHandler()
#1 {main}

Anyone have any suggestions?  Thanks.


RE: MP4 Formatter - kilishan - 08-07-2018

Is the error happening on the page that has the html on it, or when it tries to retrieve the mp4 file?

Also - I'm a little confused what the flow is? But basically it sounds like the Accepts header on the request is saying it only accepts 'video/mp4', which CodeIgniter doesn't have a way of supporting.

If I had to guess what's going on, the system is trying to access the video itself at url "{some base url}video/video.mp4" and it's hitting the api you're building. Possibly a relative path issue. Should it be "/video/video.mp4"?


RE: MP4 Formatter - InsiteFX - 08-07-2018

I would check your mine types in your OS it maybe corrupted or points to the wrong file extension.

You can check this site out but it's for Windows but mat help.

What is MIME video/mp4?


RE: MP4 Formatter - Msobomvu - 08-08-2018

Thanks for the suggestions. Turned out it was this line in public/.htaccess:

RewriteCond %{REQUEST_URI} !\.(css|gif|ico|jpg|js|png|swf|txt|svg|woff|ttf|eot)$

Simply added mp4 as such:

RewriteCond %{REQUEST_URI} !\.(css|gif|ico|jpg|js|png|swf|txt|svg|woff|ttf|eot|mp4)$

Problem solved.