{"id":2121,"date":"2010-05-30T00:00:00","date_gmt":"1970-01-01T00:00:00","guid":{"rendered":"http:\/\/johnjohnston.info\/blog\/?e=2121"},"modified":"2010-05-30T00:00:00","modified_gmt":"1970-01-01T00:00:00","slug":"mp3-players-in-glow","status":"publish","type":"post","link":"https:\/\/johnjohnston.info\/blog\/mp3-players-in-glow\/","title":{"rendered":"MP3 players in Glow"},"content":{"rendered":"\n<p style=\"text-align:center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/johnjohnston.info\/blog\/images\/2010-05\/2010-05-30_mp3s_in_glow.jpg\" alt=\"Mp3s_in_glow\" height=\"261\" width=\"460\"><\/p>\n<p>A while ago I blogged about adding some functionality to glow: <a href=\"http:\/\/johnjohnston.info\/blog\/archive\/2009\/09\/25\/glow-kludges\">Glow Kludges<\/a>, in a fairly crude way. This technique for embedding players for audio and video content into glow semi- automatically has proved useful to several teachers and classes and in a few groups I&#8217;ve created.<\/p>\n<p>I&#8217;ve managed to refine some of this a bit recently for both audio (mp3) files and some video formats, this is one of the improved techniques.<\/p>\n<p>Again the idea is to replace a link to an mp3 files in a glow document library with an embedded Flash player. This avoids users having different behaviours when clicking on a link to an mp3 depending on their operating system, browser and settings<\/p>\n<p>We use 2 JavaScript libraries <a href=\"http:\/\/jquery.com\/\">jQuery<\/a> and the <a href=\"http:\/\/jquery.thewikies.com\/swfobject\/\">jQuery SWFObject Plugin<\/a> and a small fragment of code, links to the libraries (jQuery is hosted by google and can be loaded from there, I&#8217;ve uploaded jQuery SWFObject to some glow webhosting space) and the <a href=\"http:\/\/www.alsacreations.fr\/dewplayer-en.html\">Dewplayer<\/a> Flash mp3 player.<\/p>\n<p>The links to the libraries and code are put in a glow xml webpart:<\/p>\n<div style=\"font-family: monospace;border:solid 1px #999;padding:2px \">\n <code><\/p>\n<pre><span style=\"color:#0080FF\">\/\/first link to the 2 libraries<\/span>\n&lt;script type = &quot;text\/javascript&quot;src = &quot;http:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.4.2\/jquery.min.js&quot; &gt; &lt;\/script&gt;\n&lt;script type = &quot;text\/javascript&quot;src = &quot;http:\/\/publicwebsites1.glowscotland.org.uk\/jjjs\/jquery.swfobject.min.js&quot; &gt; &lt;\/script&gt;\n &lt;span style=&quot;color:#0080FF&quot;&gt;\/\/ now replace links to mp3s with flash player&lt;\/span&gt;\n&lt;script type = &quot;text\/javascript &quot;charset = &quot;utf - 8 &quot; &gt;\n$(document).ready(\nfunction() {\n<span style=\"color:#0080FF\">\/\/ href$=.mp3 is the selector finds all links to mp3 files<\/span>\n    $(&#x27;a[href$=.mp3]&#x27;).each(function() {\n        audio_file = $(this).attr(&#x27;href&#x27;);\n        $(this).flash(\n        {\n<span style=\"color:#0080FF\">\/\/ dewplayer.swf is the flash document hosted in a glow webhosting site<\/span>\n            swf: &#x27;http:\/\/publicwebsites1.glowscotland.org.uk\/jjjs\/dewplayer.swf&#x27;,\n<span style=\"color:#0080FF\">\/\/ these arguments will be passed into the flash document<\/span>\n            flashvars: {\n                mp3: audio_file,\n            },\n            height: 20,\n            width: 200,\n        }\n        );\n<span style=\"color:#0080FF\">\/\/we need to stop the link to the file working<\/span>\n        this.onclick = function() {\n            return false;\n        };\n    }\n    );\n});\n&lt;\/script&gt;<\/pre>\n<p><\/code>\n<\/div>\n<p>Basically with the above snippet of code in an xml webpart any links to mp3 files on a page will be converted into a flash player. The xml webpart can be hidden by setting its titlebar to none. When pupils upload mp3 files into a document library on a page the flash players will be embedded.<\/p>\n<p>jQuery is an extremely powerful javascript library that is easy to use by folk like me with very limited JavaScript knowledge and very useful for adding functionality to glow.<\/p>\n<p>By the By anyone interested in altering glows appearance should check out the <a href=\"https:\/\/portal.glowscotland.org.uk\/establishments\/nationalsite\/Consolarium\/default.aspx\">Consolarium<\/a> group,  <a href=\"http:\/\/digitalgamesdesign.com\/\">Charlie Love<\/a> has sorted out how to apply a custom theme to the pages there and posted an <a href=\"http:\/\/digitalgamesdesign.com\/?p=87\" title=\"Skinning GLOW \u2013 Web Parts, CSS and the Dark Arts.\u00a0|\u00a0Digital Games Design\">explanation<\/a> and <a href=\"http:\/\/digitalgamesdesign.com\/?p=112\" title=\"Creating Your Custom Glow Theme\u00a0|\u00a0Digital Games Design\">resources<\/a> on his blog.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A while ago I blogged about adding some functionality to glow: Glow Kludges, in a fairly crude way. This technique for embedding players for audio and video content into glow semi- automatically has proved useful to several teachers and classes and in a few groups I&#8217;ve created. I&#8217;ve managed to refine some of this a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"mf2_syndication":[],"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"webmentions_disabled_pings":false,"webmentions_disabled":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[6],"tags":[8,38],"post_format":[],"class_list":{"0":"post-2121","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-wwwd","7":"tag-glowscotland","8":"tag-javascript","9":"kind-","10":"h-entry","11":"hentry"},"better_featured_image":null,"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p57zFQ-yd","jetpack_likes_enabled":false,"jetpack_sharing_enabled":true,"kind":false,"_links":{"self":[{"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/posts\/2121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/comments?post=2121"}],"version-history":[{"count":0,"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/posts\/2121\/revisions"}],"wp:attachment":[{"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/media?parent=2121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/categories?post=2121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/tags?post=2121"},{"taxonomy":"post_format","embeddable":true,"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/post_format?post=2121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}