Advertisement:

Author Topic: Play Media Attachments  (Read 24336 times)

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,859
  • Mod King
    • XPtsp.com Community
Play Media Attachments
« on: December 30, 2016, 11:43:52 PM »
Link to Mod


PLAY MEDIA ATTACHMENTS v2.6
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 RC2.  SMF 2.1 RC1 and before, as well as 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 can be viewed at XPtsp.com.

License
Copyright (c) 2016 - 2019, 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.

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,859
  • Mod King
    • XPtsp.com Community
Re: Play Media Attachments
« Reply #1 on: December 31, 2016, 10:39:19 AM »
Uploaded v1.1 - December 31st, 2016
o Changed text string in the <audio> tag to localizable string.
o Added support for SMF 2.1 Beta 2.

Offline Steve

  • Freak
  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,500
  • Gender: Male
  • I have not yet begun to procrastinate.
Re: Play Media Attachments
« Reply #2 on: January 03, 2017, 07:03:04 PM »
Still working beautifully. :D
Online Manual

Please do not PM me for support.

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,859
  • Mod King
    • XPtsp.com Community
Re: Play Media Attachments
« Reply #3 on: January 04, 2017, 09:05:23 AM »
Hello,
It's still "the hindrance to turn in circles!"
I note a concern:
I am connected, I attach an MP3 file to a subject and I click on "Submit"
The subject is published, the file is attached BUT the reading bar does not appear!
I leave the subject published.
I uninstall the Mod (without erasing it)
I reinstall the Mod AND the playbar appears!
Bizarre
Obviously, the mime type didn't get put into the database properly.  I'll look into this bug report!

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,859
  • Mod King
    • XPtsp.com Community
Re: Play Media Attachments
« Reply #4 on: January 04, 2017, 09:38:14 AM »
Uploaded v1.2 - January 4th, 2016
o Changed code so that audio/video MIME detection takes place if no MIME type detected.

Offline Steve

  • Freak
  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,500
  • Gender: Male
  • I have not yet begun to procrastinate.
Re: Play Media Attachments
« Reply #5 on: January 04, 2017, 10:09:52 AM »
Hmm ... can't seem to get this to work for some reason now ... attaching an mp3 just shows it as an attachment with no player.
Online Manual

Please do not PM me for support.

Offline Ghislain.Dejoie

  • Semi-Newbie
  • *
  • Posts: 18
Re: Play Media Attachments
« Reply #6 on: January 04, 2017, 10:45:18 AM »
Hello,
Result of the implementation of version 1.2:
I did my tests on 5 browsers and it works!
I have allowed single visitors to view attachments, and it also works
THANK YOU
« Last Edit: January 04, 2017, 11:10:27 AM by Ghislain.Dejoie »

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,859
  • Mod King
    • XPtsp.com Community
Re: Play Media Attachments
« Reply #7 on: January 06, 2017, 06:33:05 PM »
@Steve: Can't reproduce your bug report about the MP3 file.  Can you upload the file somewhere (not here) and PM me with the link to it?  Thanks!

@Ghislain.Dejoie:  Thank you for your feedback!

Offline Steve

  • Freak
  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,500
  • Gender: Male
  • I have not yet begun to procrastinate.
Re: Play Media Attachments
« Reply #8 on: January 07, 2017, 09:55:35 AM »
After your request I checked and other mp3's work fine so it's something about the particular one I'm trying to use. Where's a good place to upload it?
Online Manual

Please do not PM me for support.

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,859
  • Mod King
    • XPtsp.com Community
Re: Play Media Attachments
« Reply #9 on: January 07, 2017, 02:42:44 PM »
Dropbox, 4shared, or similar services would work.  Just Google file sharing services and pick one....

Offline Steve

  • Freak
  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,500
  • Gender: Male
  • I have not yet begun to procrastinate.
Re: Play Media Attachments
« Reply #10 on: January 07, 2017, 03:26:48 PM »
PM sent.
Online Manual

Please do not PM me for support.

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,859
  • Mod King
    • XPtsp.com Community
Re: Play Media Attachments
« Reply #11 on: January 07, 2017, 08:54:32 PM »
Uploaded v1.3 - January 7th, 2017
o Fixed MIME detection for MP3 files.



@Steve:  This update should address the issue, as the magic byte detection was incorrect for MP3 files.  Thank you for the bug report!

Offline Steve

  • Freak
  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,500
  • Gender: Male
  • I have not yet begun to procrastinate.
Re: Play Media Attachments
« Reply #12 on: January 07, 2017, 09:04:52 PM »
@Steve:  This update should address the issue ... Thank you for the bug report!

Works great now! Thanks Dougie!
Online Manual

Please do not PM me for support.

Offline davejo

  • Jr. Member
  • **
  • Posts: 333
    • Dave's Hobby Workshop
Re: Play Media Attachments
« Reply #13 on: February 21, 2017, 07:57:32 AM »
Hi Dougie,

Unfortunately after I install this mod I get the errors below.

I'm using SMF 2.0.13. I am using a custom theme but I don't think that would that cause the Display errors.

There are no errors prior to the mod install and none once it's been removed.

Any ideas?
If you want 'Quiz' questions Click here
Quiz Test Site Link

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,859
  • Mod King
    • XPtsp.com Community
Re: Play Media Attachments
« Reply #14 on: February 21, 2017, 09:45:08 AM »
Uploaded v1.4 - February 21st, 2017
o Fixed invalid array index error in Sources/Display.php.



@davejo:  This update should take care of the undefined array index errors you saw.  Thank you for the bug report!

Offline davejo

  • Jr. Member
  • **
  • Posts: 333
    • Dave's Hobby Workshop
Re: Play Media Attachments
« Reply #15 on: February 21, 2017, 11:52:39 AM »
Thanks Dougie, I will let you know how I get on tomorrow (Wednesday)
If you want 'Quiz' questions Click here
Quiz Test Site Link

Offline davejo

  • Jr. Member
  • **
  • Posts: 333
    • Dave's Hobby Workshop
Re: Play Media Attachments
« Reply #16 on: February 22, 2017, 04:47:03 AM »
Uploaded v1.4 - February 21st, 2017
o Fixed invalid array index error in Sources/Display.php.



@davejo:  This update should take care of the undefined array index errors you saw.  Thank you for the bug report!

Yep it works a treat Dougie, thanks very much for the quick reply and fix it's much appreciated.
If you want 'Quiz' questions Click here
Quiz Test Site Link

Offline ircsiinci

  • Semi-Newbie
  • *
  • Posts: 71
  • Gender: Female
    • békességnektek
Re: Play Media Attachments
« Reply #17 on: February 22, 2017, 05:23:16 AM »
Dougiefresh Hi!

Unfortunately for me it does not work.
I'm using SMF 2.0.13

To ask for help.

Thanks in advance.

Otherwise, great job, thank you., :)

Have a nice day!
........ Because she said it is better to give than to receive.

Offline Steve

  • Freak
  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,500
  • Gender: Male
  • I have not yet begun to procrastinate.
Re: Play Media Attachments
« Reply #18 on: February 22, 2017, 10:49:55 AM »
What does not work? What is it not doing?
Online Manual

Please do not PM me for support.

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,859
  • Mod King
    • XPtsp.com Community
Re: Play Media Attachments
« Reply #19 on: February 22, 2017, 09:16:45 PM »
Dougiefresh Hi!

Unfortunately for me it does not work.
I'm using SMF 2.0.13

To ask for help.

Thanks in advance.

Otherwise, great job, thank you., :)

Have a nice day!
If you are thinking that the mod is supposed to automatically play the attachment, then you are mistaken.  Is that the issue?

EDIT:  Or does the audio player not play the audio file you attached?  If this is the case, you should upload the file somewhere (not here, potential copyright issues) and PM me the link to the file, so that I can see what the issue is with the file.....

Without more information, attempting to reproduce this bug report is damn near impossible.....
« Last Edit: February 22, 2017, 09:38:13 PM by dougiefresh »