Author Topic: Play Media Attachments v2.4  (Read 2859 times)

dougiefresh

  • Adminstrator
  • Expert Member
  • *****
  • Posts: 261
Play Media Attachments v2.4
« on: Dec 07, 2016, 08:49:23 PM »

PLAY MEDIA ATTACHMENTS v2.4
By Dougiefresh -> Link to Mod


Introduction
This mod allows MP3, WAV, WMA, AAC, and audio OGG files that has been attached to a post to be played without manually downloading the attachment using the HTML5 audio tag.

This mod also allows a MP4, M4A, M4V, WebM, WMV, MOV, and video OGG files that has been attached to a post to be played without manually downloading the attachment using the HTML5 video tag.

Note: OGG format files are assumed to be video if the extension is OGV.  Detection has yet to be improved upon for determining the difference between audio and video OGG-formatted files.

Admin Settings
In Admin -> Forum -> Attachments and Avatars -> Attachment Settings, there are two new options:
o Width of Audio Player element
o Width of Video Player element

Inspiration & Credit
The Javascript code used was copied and adapted from this webpage: JavaScript spoiler with a twist (collapsing up or down)

Compatibility Notes
This mod was tested on SMF 2.0.14, but should work on SMF 2.0 and up, as well as SMF 2.1 Beta 3.  SMF 2.1 Beta 2 and SMF 1.x will not be supported.

PM Attachments should be installed before this mod (not required).  Only PM Attachments mod version 2.1 and above are supported!

Changelog
The changelog has been removed and can be seen at XPtsp.com.

License
Quote
Copyright (c) 2016 - 2018, Douglas Orend
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
« Last Edit: Dec 31, 2016, 09:56:47 AM by dougiefresh »

dougiefresh

  • Adminstrator
  • Expert Member
  • *****
  • Posts: 261
Re: [A] Play Media Attachments v1.0
« Reply #1 on: Dec 07, 2016, 08:50:22 PM »

Below are some preview images of what the mod looks like when being used

Download Mod


FileName: Play_Media_Attachments_v2.4.zip
Size: 12 kb (12,722 bytes)
MD5: beed5ae9ffcad1cf2c5455188d7becb1
Built: Apr 29, 2018, 04:11:19 AM
Downloaded 39 times

Changelog

Uploaded v2.4 - April 28th, 2018
o Added mime detection for QuickTime (.mov) movies.
o Added code fragment to exclude mime type from HTML when playing QT movies.
o Fixed conditional statement so that video embed tag works if needed.

Uploaded v2.3 - December 15th, 2017
o Added Spanish Latin translation, courtsey of Rock Lee!
o Added missing add/remove hooks entry for proper mod uninstallation.

Uploaded v2.2 - December 8th, 2017
o Fixed several undefined element/variable errors in the mod.

Uploaded v2.1 - September 10th, 2017
o Fixed expired session error upon mod install.
o Added file signatures and mime types for WMA, WMV and AAC files.

Uploaded v2.0.1 - September 9th, 2017
o Fixed another stupid typo in Subs-MediaAttachments.php.

Uploaded v2.0 - September 8th, 2017
o Added support for the PM Attachments mod.
o Fixed variable type-casting error in Subs-MediaAttachments.php.
o Added stuff to redetect MIME types in Attachment File Maintanence area.
o Added code to restrict additional MIME testing to audio/video files.

Uploaded v1.11.1 - September 6th, 2017
o Fixed stupid typo in Subs-MediaAttachments.php.

Uploaded v1.11 - September 4th, 2017
o Fixed HTML code that displays the attachment audio/video elements.
o Updated file signature detection code to catch M4A and M4V files.

Uploaded v1.10 - August 2nd, 2017
o Added code to display supported video clips stored as attachments.
o Added video width option to settings.
o Adjusted audio operation to use new audio width option.
o Added audio width option to settings.

Uploaded v1.9 - July 11th, 2017
o Fixed WAV audio file type detection code.

Uploaded v1.8 - July 8th, 2017
o Fixed incorrect operation in Display.template.php.

Uploaded v1.7 - July 6th, 2017
o Added support for SMF 2.1 Beta 3.
o Removed support for SMF 2.1 Beta 2.
o Added admin setting to set the audio player width.

Uploaded v1.6 - March 19th, 2017
o Attempted thumbnail generation fix when no audio/video MIME type present.

Uploaded v1.5 - February 23rd, 2017
o Added fallback audio player as an embed to the mod.

Uploaded v1.4 - February 21st, 2017
o Fixed invalid array index error in Sources/Display.php.

Uploaded v1.3 - January 7th, 2017
o Fixed MIME detection for MP3 files.

Uploaded v1.2 - January 4th, 2016
o Changed code so that audio/video MIME detection takes place if no MIME type detected.

Uploaded v1.1 - December 31st, 2016
o Changed text string in the tag to localizable string.
o Added support for SMF 2.1 Beta 2.

Uploaded v1.0 - December 7th, 2016
o Initial release to the public

Samana Johann

  • Regular Member
  • *
  • Posts: 10
    • sangham.net
Re: Play Media Attachments v1.0
« Reply #2 on: Apr 06, 2017, 09:14:12 AM »
Douglas,

my person trust that this post is welcome. Please delete it without hesitating and pardon it, in the case of not welcome and of no use for you.

Sometimes ago my person made a mod suggestion on smf but it was deleted. Since you mod matches some parts of it, my person thought of sharing the old suggestion for possible inspiration.

Quote from: Audio integration some test on sangham.net
Valued SMF team,
Dear SMF Supporter,

Ātman remembers having ask a while ago, but due his bad language skills, the topic was misunderstood and the message got lost.

It would be great to have the possibility to make voice conversation and discussion possible with an embed recorder and player. Ātma tries to give a more visible sample.

When you post, you have the possibility to make a record.



After that you may attach the record when posting say as user_topicNo_postNr.amr/mp3

And within the post it would appear as a online player

[click to listen]

One could quote this later on as well.
Maybe it would be good to enable and disable it also for certain boards.

It could make SMF to a perfect communication tool. Aside of online talk, one could follow a communication and discussion later on as well. Just like normal discussion.

It would be also possible to make a perfect educational forum. Not sure in detail, but such as PoodLL https://moodle.org/plugins/repository_poodll look interesting. In the same way it there could be make such as video and draw available as well.
« Last Edit: Apr 06, 2017, 09:21:05 AM by Samana Johann »

dougiefresh

  • Adminstrator
  • Expert Member
  • *****
  • Posts: 261
Re: Play Media Attachments v1.0
« Reply #3 on: Apr 07, 2017, 11:08:26 AM »
I can look into the request....

Samana Johann

  • Regular Member
  • *
  • Posts: 10
    • sangham.net
Re: Play Media Attachments v1.0
« Reply #4 on: Apr 09, 2017, 03:21:07 AM »
Sadhu! (Excellent! Expression that appreciates skillful deed of others)

Please, please, please... since Douglas surely often looks like his avatar, its really not a personal "I must have that" or a "how to get it for my self" thing, even it came out of the thought "would be creat if such is possible", yes. So it should in no way cause any joyless effort and its meant for inspiration since having seen that Douglas work on parts already. What ever good might be done with it here and after.

Mudita! (Sympatic joy, joy with or appreciating of good deeds and merits or the results and benefits of deeds done by of others, benefiting others)
« Last Edit: Apr 09, 2017, 04:22:56 AM by Samana Johann »

Samana Johann

  • Regular Member
  • *
  • Posts: 10
    • sangham.net
Re: Play Media Attachments v1.0
« Reply #5 on: Jul 22, 2017, 06:54:32 PM »
My person installed it now (SMF 2.0.14) and thought it would be good to report that while WAV seems to work well the player is not shown for mp3. Would it be enough just to add the file_signatures (wonder if working for other files as well, such as pdf)

Like
Code: [Select]
$signatures = array(
"\x52\x49\x46\x46" => 'audio/wav|8|' . "\x57\x41\x56\x45",
"\xFF\xFB" => 'audio/mpeg',
"\x49\x44\x33" => 'audio/mpeg',
"\x49\x44\x33" => 'audio/mp3',
"\xFF\xFB" => 'audio/mp3',
"\x25\x50\x44\x46" => 'audio/pdf',
"\x4F\x67\x67\x53" => 'audio/ogg',
"\x1A\x45\xDF\xA3" => 'video/webm',
"\x00\x00\x00\x14\x66\x74\x79\x70\x71\x74\x20\x20" => 'video/mp4',
"\x00\x00\x00\x18\x66\x74\x79\x70\x6D\x70\x34\x32" => 'video/mp4',
"\x00\x00\x00\x20\x66\x74\x79\x70\x33\x67\x70" => 'video/mp4',
);

And
Code: [Select]
'extensions' => array('mp3', 'wav', 'ogg', 'oga', 'mp4', 'ogv', 'webm', 'pdf'),
If it's "just" a matter of file signature: for amr file can be found here http://filesignatures.net/index.php?page=search&search=AMR&mode=EXT

Attached german language file
« Last Edit: Jul 22, 2017, 07:48:20 PM by Samana Johann »

Samana Johann

  • Regular Member
  • *
  • Posts: 10
    • sangham.net
Re: Play Media Attachments v1.0
« Reply #6 on: Jul 22, 2017, 08:44:12 PM »
Have seen that amr-files are not supported by html5 so far.

Samana Johann

  • Regular Member
  • *
  • Posts: 10
    • sangham.net
Re: Play Media Attachments v1.0
« Reply #7 on: Sep 06, 2017, 06:17:21 AM »
Valued Douglas,

Just installed the new 1.11 version and while doing so got this error:

Quote
Parse error: syntax error, unexpected ')' in /var/www/clients/client2157/web5410/web/Packages/temp/Subs-MediaAttachments.php on line 52

Since then, not able to access the Admin-pages which in trying gives the same message. Other pages seems to work and looking if possible installed, medias are not displayed.

So on one hand as feedback, and honestly no idea how to fix the own problem now.

If able to give advises, such would be great.
(Using smf 2.14)

As info, most the time you page here is not reachable but gives a cloud page and if there is this error displayed on the top:

Quote
Warning: file_put_contents(/ff_9d96b37fab230d71368226e389006cb1f9fe12a7f75174e7.php): failed to open stream: Permission denied in /hsphere/local/home/bbbmtgi/xptsp.com/board/Sources/Subs-ForumFirewall.php on line 1619

Hope that is useful as well.
« Last Edit: Sep 06, 2017, 06:35:51 AM by Samana Johann »