Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: Multimedia Options in Texteditor  (Read 3380 times)

Wolfgang

  • Newbie
  • *
  • Karma: 1
  • Posts: 20
    • http://1-2-3-4.info
Multimedia Options in Texteditor
« on: January 19, 2007, 01:56:45 pm »

Was just wondering, if sNews in future will be planning to expand the texteditor to include possibilities for not only "img" as is now, but also for "object" when embedding say a movie file or stream or music or something along those lines. just my layman's question. Please don't hang me, if this way out of line.

As it is now, this is done by just including the raw HTML tag code (for me not a problem), but for my mom and grandma, if they want to do the same. Of course, for me it would also be more convenient, so I would not mind either.
Logged

Luka

  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 36
  • Posts: 1717
    • http://www.snewscms.com
Multimedia Options in Texteditor
« Reply #1 on: January 19, 2007, 02:19:06 pm »

Well there's no limit for expanding these including possibilities.

The best solution IMHO would be to create a small mod just to show additional embed button which would include a video, music or something else.

I think it shouldn't be more then a few lines of code.
Logged

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
Multimedia Options in Texteditor
« Reply #2 on: January 20, 2007, 01:12:23 am »

I found this script very useful.  It automatically adds a play button to all mp3 links.  And if you click on the file name it will download the file, which can be customized of curse.

See an example in my Testing Page (Is a messy page, just for testing)
http://www.zucye.net/musica-letras/mis-canciones-favoritas/

All you have to do is call the script in the head section:


And create the playMp3.js file as follows:
Code: [Select]
// Change these two lines to modify your PLAY and STOP buttons.
var mp3PlayButton = "http://www.jpgsvr.com/mp3/play2.gif";
var mp3StopButton = "http://www.jpgsvr.com/mp3/stop2.gif";
// Change these two lines to modify the "playing..." font and size.
var mp3PlayingFont = "Verdana";
var mp3PlayingSize = "8pt";

//var mp3PlayButton = "http://www.jpgsvr.com/mp3/play.png";
//var mp3StopButton = "http://www.jpgsvr.com/mp3/pause.png";

if(typeof(TagTooga) == 'undefined')
TagTooga = {}

TagTooga.Mp3 =
{
playimg: null,
player: null,

go: function()
{
var all = document.getElementsByTagName('a');
for (var i = 0, o; o = all[i]; i++)
{
if(o.href.match(/\.mp3$/i))
{
var img = document.createElement('img');
img.src = mp3PlayButton;
img.title = 'listen';
//img.height = img.width = 12;
img.style.marginRight = '0.5em';
img.style.cursor = 'pointer';
img.onclick = TagTooga.Mp3.makeToggle(img, o.href);
o.parentNode.insertBefore(img, o);
}
}
},

toggle: function(img, url)
{
if (TagTooga.Mp3.playimg == img)
TagTooga.Mp3.destroy();
else
{
if (TagTooga.Mp3.playimg)
TagTooga.Mp3.destroy();
var a = img.nextSibling;

img.src = mp3StopButton;
TagTooga.Mp3.playimg = img;
TagTooga.Mp3.player = document.createElement('span');
TagTooga.Mp3.player.innerHTML = 'playing...'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"' +
'width="1" height="1" id="player" align="middle">' +
'' +
'' +
'' +
'' +
' 'quality="high" wmode="transparent" width="1" height="1" name="player"' +
'align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"' +
' pluginspage="http://www.macromedia.com/go/getflashplayer" />
';
img.parentNode.insertBefore(TagTooga.Mp3.player, img.nextSibling);
}
},

destroy: function()
{
TagTooga.Mp3.playimg.src = mp3PlayButton;
TagTooga.Mp3.playimg = null;
TagTooga.Mp3.player.removeChild(TagTooga.Mp3.player.firstChild);
TagTooga.Mp3.player.removeChild(TagTooga.Mp3.player.firstChild);
TagTooga.Mp3.player.parentNode.removeChild(TagTooga.Mp3.player);
TagTooga.Mp3.player = null;
},

makeToggle: function(img, url)
{
return function()
{
TagTooga.Mp3.toggle(img, url);
}
}
}

TagTooga.addLoadEvent = function(f)
{
var old = window.onload;

if (typeof old != 'function')
window.onload = f;
else
{
window.onload = function() { old(); f() }
}
}

TagTooga.addLoadEvent(TagTooga.Mp3.go);
(function() {

var page_links = document.links;
for (var i=0; i if (page_links[i].href.match(/\.mp3$/i)) {
var span = document.createElement("span");
var url = "http://musicplayer.sourceforge.net/xspf_player_slim.swf?&song_url="+escape(page_links[i].href)+"&song_title="+escape(page_links[i].innerHTML)
var width = 200
var height = 15
code_str = ""
code_str += " code_str += "data=\""+url+"\" \n"
code_str += "width=\""+width+"\" height=\""+height+"\">\n"
code_str += " code_str += "value=\""+url+"\" />\n"
code_str += " code_str += "value=\"transparent\" />\n"
code_str += "
\n"
span.innerHTML = code_str
page_links[i].parentNode.insertBefore(span, page_links[i].nextSibling)
}
}

})();
Then just insert a link and you are done. Sample:
Unchained Melody - Click to download
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Multimedia Options in Texteditor
« Reply #3 on: January 20, 2007, 01:23:42 am »

I like the simplicity in your implementation. And your choice of tunes as well. :)
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
Multimedia Options in Texteditor
« Reply #4 on: January 20, 2007, 02:42:17 am »

Quote from: keyrocks
I like the simplicity in your implementation. And your choice of tunes as well. :)
Right they nice :) I just love them....
 ;)
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • ďI'm a self-made man and worships my creator.Ē
    • p-ahlqvist.com
Multimedia Options in Texteditor
« Reply #5 on: January 20, 2007, 10:52:29 am »

Aha, econds that...Brings back memories ;)... and finally a better shot of you :lol: A bit blurry, but we got to see a bit more Zyc... It is you ?

Ahhhhh, "will always looooooooooooooove you oooooooooooooooouhuhuhuuuu" - Haven't heard that for some time... thanks Zyc... Must go digging in my vinyl box now ;)
Logged
"It's only dead fish that goes with the flow... "
Updated

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
Multimedia Options in Texteditor
« Reply #6 on: January 22, 2007, 07:57:36 pm »

Glad you like them Patrick and hope you had a good time with your vinyl box :D
PD: Some pics of me and my family :)

As for the button player.  There is a probably better option at the following link:
http://musicplayer.sourceforge.net/

Also, the player on the top of the page refreshes every time one clicks on a link (article, category, page). Is there any way I can avoid that without using frames?
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)

Wolfgang

  • Newbie
  • *
  • Karma: 1
  • Posts: 20
    • http://1-2-3-4.info
Multimedia Options in Texteditor
« Reply #7 on: January 23, 2007, 08:37:42 am »

@Zucyue, that one from Sourceforge looks great!
Logged

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
Multimedia Options in Texteditor
« Reply #8 on: January 24, 2007, 05:33:48 pm »

I just realized that del.icio.us, offers the pretty much the same script I posted first, plus it lets you tag it right from the link.

http://del.icio.us/help/playtagger

Again, any ideas how to prevent the mp3 player from refreshing??
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
Multimedia Options in Texteditor
« Reply #9 on: February 28, 2007, 09:48:42 pm »

Looking for a way to keep the music playing while moving from page to another, I came across this player:
http://www.schillmania.com/projects/soundmanager2/

At that time Scott had the player on his index page and to my surprise I didnít restarted as I moved around his site (which by the way is very interesting).  He explained to me, that he uses AJAX to accomplish this look, after reviewing a few links he sent me I understood that AJAX is out of my league.  I just though Iíll post it here in case someone is interested.
Quote from: Scott Schiller
I'm using Javascript, the xmlhttprequest (XHR, the core object behind
"ajax") object to make dynamic requests without refreshing the page. Without
XHR, my MP3 player would do the same thing yours does (stop and restart on
every page load.)
.......

The Yahoo! User Interface (YUI) library also has some functionality like
this, which you might find useful.

They have a "tab view" control which may use the same kind of technique
you'd like to employ.
http://developer.yahoo.com/yui/tabview/

From this URL, see "Examples" and then "dynamically loading tab content"
http://developer.yahoo.com/yui/
......
**I almost accomplish what I wanted using frames.  Is not quite what I was looking for, but the music keeps playing as one moves around the site (which by the way is not finish, some links donít work)
 
http://www.zucye.net
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)