Add capability to play HTML5 native formats without bbcode

Looking for an Extension? Have an Extension request? Post your request here for help. (Note: This forum is community supported; while there is an Extensions Development Team, said team does not dedicate itself to handling requests in this forum)
Suggested Hosts
User avatar
Leinad4Mind
Translator
Posts: 852
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Re: Add capability to play HTML5 native formats without bbcode

Post by Leinad4Mind » Thu Mar 03, 2016 12:17 am

stefd75 wrote:i did all these tests too ...

as i said before, the onlyone solution is to not encrypte .mp4 as actual physical name.. because these cheet of safari and ios don't want to read.

We must develop a module to upload mp4 like this : iduser_idunique_nameofvideo.mp4 and it will work.

i'm ready to pay someone to do this, contact me.
if you think it work then edit the functions_posting

find

Code: Select all

$file->clean_filename('unique', $user->data['user_id'] . '_');
replcace with

Code: Select all

$file->clean_filename('unique_ext', $user->data['user_id'] . '_');
it will save with:
prefix _ md5(unique_id()) . extension;

The result will be: 2_92891c0080df9c4b0f76a5e4033bcdba.mp4
instead of 2_92891c0080df9c4b0f76a5e4033bcdba

if you write 'real' instead of 'unique_ext' it will save you: prefix_realname.extension

if you want as you said, iduser_idunique_nameofvideo.mp4

then open functions_upload and find:

Code: Select all

			case 'unique_ext':
			default:
				$this->realname = $prefix . md5(unique_id()) . '.' . $this->extension;
			break;
paste after:

Code: Select all

			case 'unique_video':
			default:
				$this->realname = $user_id . '_' . md5(unique_id()) . '_' . $this->realname;
			break;
and on functions_posting put unique_video instead of unique of the code above. Ok?


after that dont forget to put this instead on the attachment.html:

Code: Select all

      <!-- ELSEIF _file.S_H5_FILE -->
         <!-- IF _file.MIMETYPE == 'audio/mp3' -->
            <audio src="{_file.U_DOWNLOAD_LINK}" name="media" controls="true">
				<source src="{_file.U_DOWNLOAD_LINK}" type="{_file.MIMETYPE}" controls="true">
            </audio>
         <!-- ELSE -->
            <video src="{_file.U_DOWNLOAD_LINK}" height='80%' width='80%' controls="true">
            <source src="{_file.U_DOWNLOAD_LINK}" type="{_file.MIMETYPE}" controls="true">
            </video>
         <!-- ENDIF -->
Cheers!

And its working on Windows Safari and Mac Safari. I'll presume it will work on iPhone and iPads too.
People with iPhone and iPad told me it works
Last edited by Leinad4Mind on Mon Oct 09, 2017 12:40 pm, edited 1 time in total.
Want to access all my portuguese MOD and Extension translations?
Become my Patreon!
phpBB Portugal Translator and Moderator

Tarantino
Registered User
Posts: 767
Joined: Sat Feb 18, 2012 1:51 pm
Contact:

Re: Add capability to play HTML5 native formats without bbcode

Post by Tarantino » Sat Mar 05, 2016 3:20 pm

All the code changes with Leinad4Mind input:

Open /includes/constants.php and find:

Code: Select all

// Categories - Attachments
define('ATTACHMENT_CATEGORY_NONE', 0);
define('ATTACHMENT_CATEGORY_IMAGE', 1); // Inline Images
define('ATTACHMENT_CATEGORY_WM', 2); // Windows Media Files - Streaming
define('ATTACHMENT_CATEGORY_RM', 3); // Real Media Files - Streaming
define('ATTACHMENT_CATEGORY_THUMB', 4); // Not used within the database, only while displaying posts
define('ATTACHMENT_CATEGORY_FLASH', 5); // Flash/SWF files
define('ATTACHMENT_CATEGORY_QUICKTIME', 6); // Quicktime/Mov files                      
After, add:

Code: Select all

define('ATTACHMENT_CATEGORY_HTML5', 7); // Native HTML5 files                      
Open /language/en/acp/attachments.php and find:

Code: Select all

    'CAT_FLASH_FILES'            => 'Flash files',
    'CAT_IMAGES'                => 'Images',
    'CAT_QUICKTIME_FILES'        => 'Quicktime media files',
    'CAT_RM_FILES'                => 'RealMedia media files',
    'CAT_WM_FILES'                => 'Windows Media media files',
After, add:

Code: Select all

'CAT_H5_FILES'                => 'HTML5 native media files',
Open /includes/acp/acp_attachments.php and find:

Code: Select all

                $cat_lang = array(
                    ATTACHMENT_CATEGORY_NONE        => $user->lang['NO_FILE_CAT'],
                    ATTACHMENT_CATEGORY_IMAGE        => $user->lang['CAT_IMAGES'],
                    ATTACHMENT_CATEGORY_WM            => $user->lang['CAT_WM_FILES'],
                    ATTACHMENT_CATEGORY_RM            => $user->lang['CAT_RM_FILES'],
                    ATTACHMENT_CATEGORY_FLASH        => $user->lang['CAT_FLASH_FILES'],
                    ATTACHMENT_CATEGORY_QUICKTIME    => $user->lang['CAT_QUICKTIME_FILES'], 
After, add:

Code: Select all

                    ATTACHMENT_CATEGORY_HTML5        => $user->lang['CAT_H5_FILES'], 
In the same file, find:

Code: Select all

        $types = array(
            ATTACHMENT_CATEGORY_NONE        => $user->lang['NO_FILE_CAT'],
            ATTACHMENT_CATEGORY_IMAGE        => $user->lang['CAT_IMAGES'],
            ATTACHMENT_CATEGORY_WM            => $user->lang['CAT_WM_FILES'],
            ATTACHMENT_CATEGORY_RM            => $user->lang['CAT_RM_FILES'],
            ATTACHMENT_CATEGORY_FLASH        => $user->lang['CAT_FLASH_FILES'],
            ATTACHMENT_CATEGORY_QUICKTIME    => $user->lang['CAT_QUICKTIME_FILES'], 
After, add:

Code: Select all

            ATTACHMENT_CATEGORY_HTML5    => $user->lang['CAT_H5_FILES'], 
Open /includes/functions_content.php and find:

Code: Select all

        $block_array += array(
            'UPLOAD_ICON'        => $upload_icon,
            'FILESIZE'            => $filesize['value'],
            'SIZE_LANG'            => $filesize['unit'],
            'DOWNLOAD_NAME'        => utf8_basename($attachment['real_filename']),
            'COMMENT'            => $comment, 
After, add:

Code: Select all

            /*** 2015-06-01 BEGIN AmigoJack
                https://www.phpbb.com/community/viewtopic.php?f=71&t=2318416 ***/
            'MIMETYPE'=> $attachment['mimetype'],
            /*** 2015-06-01 END ***/ 
In the same file, find:

Code: Select all

                // Windows Media Streams
                case ATTACHMENT_CATEGORY_WM:

                    // Giving the filename directly because within the wm object all variables are in local context making it impossible
                    // to validate against a valid session (all params can differ)
                    // $download_link = $filename;

                    $block_array += array(
                        'U_FORUM'        => generate_board_url(),
                        'ATTACH_ID'        => $attachment['attach_id'],
                        'S_WM_FILE'        => true,
                    );

                    // Viewed/Heared File ... update the download count
                    $update_count[] = $attachment['attach_id'];
                break; 
After, add:

Code: Select all

                // Native HTML5 Media Streams
                case ATTACHMENT_CATEGORY_HTML5:

                    // HTML browsers play mp4, webm and ogg video formats - and, the mp3 audio format - natively

                    $block_array += array(
                        'U_FORUM'        => generate_board_url(),
                        'ATTACH_ID'        => $attachment['attach_id'],
                        'S_H5_FILE'        => true,
                    );

                    // Viewed/Heared File ... update the download count
                    $update_count[] = $attachment['attach_id'];
                break;
Find in styles/prosilver/template/attachment.html:

Code: Select all

		<!-- ELSEIF _file.S_QUICKTIME_FILE -->
			<object id="qtstream_{_file.ATTACH_ID}" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" width="320" height="285">
				<param name="src" value="{_file.U_DOWNLOAD_LINK}" />
				<param name="controller" value="true" />
				<param name="autoplay" value="false" />
				<param name="type" value="video/quicktime" />
				<embed name="qtstream_{_file.ATTACH_ID}" src="{_file.U_DOWNLOAD_LINK}" pluginspage="http://www.apple.com/quicktime/download/" enablejavascript="true" controller="true" width="320" height="285" type="video/quicktime" autoplay="false"></embed>
			</object>
After, add:

Code: Select all

		<!-- ELSEIF _file.S_H5_FILE -->
			<!-- IF _file.MIMETYPE == 'audio/mp3' -->
				<audio src="{_file.U_DOWNLOAD_LINK}" controls="true" name="media">
					<source src="{_file.U_DOWNLOAD_LINK}" type="{_file.MIMETYPE}" controls="true">
				</audio>
			<!-- ELSE -->
				<video src="{_file.U_DOWNLOAD_LINK}" controls="true" name="media">
					<source src="{_file.U_DOWNLOAD_LINK}" type="{_file.MIMETYPE}" controls="true">
				</video>
			<!-- ENDIF -->
In the same file, find:

Code: Select all

		<!-- IF _file.S_WM_FILE or _file.S_RM_FILE or _file.S_FLASH_FILE or _file.S_QUICKTIME_FILE -->
Edit this line to:

Code: Select all

		<!-- IF _file.S_WM_FILE or _file.S_RM_FILE or _file.S_FLASH_FILE or _file.S_QUICKTIME_FILE or _file.S_H5_FILE -->
Find in phpbb/mimetype/extension_guesser.php:

Code: Select all

'mp3'		=> 'audio/x-mpeg-3',
Edit this line to:

Code: Select all

'mp3'		=> 'audio/mp3',
Find in includes/functions_posting.php:

Code: Select all

$file->clean_filename('unique', $user->data['user_id'] . '_');
Edit this line to:

Code: Select all

$file->clean_filename('unique_video', $user->data['user_id'] . '_');
Find in includes/functions_upload.php:

Code: Select all

         case 'unique_ext':
         default:
            $this->realname = $prefix . md5(unique_id()) . '.' . $this->extension;
         break;
After add:

Code: Select all

         case 'unique_video':
         default:
            $this->realname = $user_id . '_' . md5(unique_id()) . '_' . $this->realname;
         break;
;)
Last edited by Tarantino on Wed Mar 16, 2016 4:35 pm, edited 1 time in total.

User avatar
stefd75
Registered User
Posts: 10
Joined: Sat Feb 20, 2016 1:39 pm

Re: Add capability to play HTML5 native formats without bbcode

Post by stefd75 » Tue Mar 08, 2016 11:43 am

I confirm it's work perfectly, but be carefull if u have an other extension using posting function, you need to modify it ... like watermark ext for example !

Also mega thanks to @leina to find the issue
May be one day there will be an official ext :D

Tom49er
Registered User
Posts: 133
Joined: Sat Jun 07, 2014 4:51 am

Re: Add capability to play HTML5 native formats without bbcode

Post by Tom49er » Sun May 22, 2016 9:43 am

Hi,

I followed these steps, but MP3 is not working. It said
[The extension mp3 has been deactivated and can no longer be displayed.]
. Do I have to set up on ACP attachment? Thanks

Tabitha2
Registered User
Posts: 35
Joined: Wed Oct 17, 2012 7:09 am

Re: Add capability to play HTML5 native formats without bbcode

Post by Tabitha2 » Sun May 22, 2016 11:58 am

extension please ;)

User avatar
Scanialady
Registered User
Posts: 286
Joined: Thu Jan 17, 2013 7:09 pm
Location: Germany
Name: Annette
Contact:

Re: Add capability to play HTML5 native formats without bbcode

Post by Scanialady » Sun May 22, 2016 12:02 pm

Tabitha2 wrote:extension please ;)
+1

;)
Webseite, Blog, Wiki Deutsche Übersetzungen - german language files
My 2 cents: Whether an extension is in the CDB says nothing about its quality. It is more important to read the support topics for it. Better to avoid authors who do not answer support questions themselves, who do not update their stuff, and who do not fix bugs for years.

Tom49er
Registered User
Posts: 133
Joined: Sat Jun 07, 2014 4:51 am

Re: Add capability to play HTML5 native formats without bbcode

Post by Tom49er » Mon May 23, 2016 12:37 am

After I deleted caches, It showed attachment link. How can it play without download the link on PhpBB 3.1.9 ? Thanks.

User avatar
MarkDHamill
Registered User
Posts: 3952
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: Add capability to play HTML5 native formats without bbcode

Post by MarkDHamill » Mon May 23, 2016 5:01 pm

I put in an enhancement request some months back to allow .mp4 and .ogg files to play as HTML 5 videos encapsulated in a <video> tag. Currently phpBB will try to kickoff Quicktime plug in to play these, which a lot of people won't install.

It seems an obvious thing to do.

https://tracker.phpbb.com/browse/PHPBB3-14246?filter=-2
Get the latest versions of my Digests and Smartfeed extensions.
Need phpBB services or a phpBB consultant? I offer most phpBB services.

User avatar
shortmort37
Registered User
Posts: 427
Joined: Sat Aug 26, 2006 8:40 pm
Location: Upper Darby, PA, USA
Name: Dan Morton
Contact:

Re: Add capability to play HTML5 native formats without bbcode

Post by shortmort37 » Tue May 24, 2016 12:54 am

MarkDHamill wrote:I put in an enhancement request some months back to allow .mp4 and .ogg files to play as HTML 5 videos encapsulated in a <video> tag. Currently phpBB will try to kickoff Quicktime plug in to play these, which a lot of people won't install.

It seems an obvious thing to do.

https://tracker.phpbb.com/browse/PHPBB3-14246?filter=-2
Obvious? Yes. Without having to explicitly embed a <video> tag. No bbcode, no embedded player, just using the native capability of any HTML5 compliant browser.

I thought that was the purpose of this subforum - a place to submit enhancement requests. Which is what I did, nearly a year ago now, supplying all the requisite modification code for an extension, which I don't know how to make.

If there's another place I should have submitted the request, that's news to me.

User avatar
MarkDHamill
Registered User
Posts: 3952
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: Add capability to play HTML5 native formats without bbcode

Post by MarkDHamill » Tue May 24, 2016 1:38 am

tracker.phpbb.com is used to submit bug requests and enhancement requests principally. If you want an extension you can ask for it here but the odds are slim it will get taken up. My suggestion has been sitting in a queue getting no attention but it's something to do. I suspect is it quite simple, and attachment.html could probably be hacked to affect the change.
Get the latest versions of my Digests and Smartfeed extensions.
Need phpBB services or a phpBB consultant? I offer most phpBB services.

Tabitha2
Registered User
Posts: 35
Joined: Wed Oct 17, 2012 7:09 am

Re: Add capability to play HTML5 native formats without bbcode

Post by Tabitha2 » Sun Sep 25, 2016 12:51 pm

news? :)

User avatar
MarkDHamill
Registered User
Posts: 3952
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: Add capability to play HTML5 native formats without bbcode

Post by MarkDHamill » Sun Sep 25, 2016 6:33 pm

It's unresolved. Perhaps someone will write an extension. This should be a no-brainer but there are so many things they are doing at once to get out a release it would not surprise me if they let this one slip.
Get the latest versions of my Digests and Smartfeed extensions.
Need phpBB services or a phpBB consultant? I offer most phpBB services.

Tabitha2
Registered User
Posts: 35
Joined: Wed Oct 17, 2012 7:09 am

Re: Add capability to play HTML5 native formats without bbcode

Post by Tabitha2 » Sun Sep 25, 2016 7:32 pm

damage, this extension is requested by many people

User avatar
shortmort37
Registered User
Posts: 427
Joined: Sat Aug 26, 2006 8:40 pm
Location: Upper Darby, PA, USA
Name: Dan Morton
Contact:

Re: Add capability to play HTML5 native formats without bbcode

Post by shortmort37 » Wed Sep 28, 2016 12:12 am

I have an update.

1) I modified my code to include the file extension when saving the hashed filename for an attachment, as described by others in this thread - despite the fact that it did not address attachments that had already been stored, without a file extension. Myself, I did not find that it addressed the problem of being able to play mp3's or mp4's natively within phpBB on iOS devices.

2) It turns out, that iOS expects the server to respond to "byte range requests", as described here:
Appendix A: Streaming for Apple iPhone wrote:Apple iPhone uses HTTP byte-ranges for requesting audio and video files. First, the Safari Web Browser requests the content, and if it’s an audio or video file it opens it’s media player. The media player then requests the first 2 bytes of the content, to ensure that the Webserver supports byte-range requests. Then, if it supports them, the iPhone’s media player requests the rest of the content by byte-ranges and plays it.
Without modification, phpBB does not support byte range requests. It needs a modification. You can read the full thread here.

3) With attribution to kasimi, who was very helpful - I modified includes/functions_download.php. I am now able to play mp3's and mp4's on iOS devices, without storing the extension as part of the hashed filename. That's not the issue for iOS - it does not derive Content-Type from the extension. I have modified the initial post in this thread to include the change to functions_download.php that will enable iOS to play HTML5 content natively.

4) I am not able to provide an extension! Besides not knowing how to write one, functions_download.php does not contain any events that would enable the code changes to be delivered via an extension. An event would have to be requested:
kasimi wrote:There's no event in that function so you'll have to request one to be added, or modify core code.

Tabitha2
Registered User
Posts: 35
Joined: Wed Oct 17, 2012 7:09 am

Re: Add capability to play HTML5 native formats without bbcode

Post by Tabitha2 » Wed Sep 28, 2016 8:24 am

Thanks for your wonderful work ;)

Post Reply

Return to “Extension Requests”