embedding flash mp3 player, without js
-
When something can be processed and generated before posting, why the hell would I want to trade it for mountains of javascript libraries that dynamically replace tags in order to add a flash player?? I can understand that plugin developers would, so it is easy for beginners to get a hold of. But I want fast, over hidden.
I went back to the basics and used the simplest flash player I could find. Ive updated the media.php script that gives the author a checkbox that will include the flash object along with the link when sent to the editor.
This is the mp3 player im using (all flash, no javascript… yummmy):
https://musicplayer.sourceforge.net/This is a code diff from 2.6.1 media.php and my edits, anyone is welcome to take this and make a plugin, if they want, or just use it and edit media.php manually:
(you will need to statically define herein the domain where the music player can be found):289,291d288 < if ( !empty($attachment['showplayer']) ) < $html .= " <object type='application/x-shockwave-flash' data='https://YOURDOMAIN.com/DIR/musicplayer.swf?song_url=".$attachment['url']."&song_title=".$attachment['post_title']."' width='17' height='17'><param name='movie' value='https://YOURDOMAIN.com/DIR/musicplayer.swf?song_url=".$attachment['url']."&song_title=".$attachment['post_title']." /> </object>"; < 382c379 < if ( !empty($title) && !empty($href) ) { --- > if ( !empty($title) && !empty($href) ) 384,388d380 < $showplayer = attribute_escape($_POST['insertonly']['showplayer']); < if ( !empty($showplayer) ) < $html .= " <object type='application/x-shockwave-flash' < data='https://YOURDOMAIN.com/DIR/musicplayer.swf?song_url=".$href."&song_title=".$title."' width='17' height='17'><param name='movie' value='https://YOURDOMAIN.com/DIR/musicplayer.swf?song_url=".$href."&song_title=".$title." /> </object>"; < } 556,568d547 < function audio_attachment_fields_to_edit($form_fields, $post) { < if ( substr($post->post_mime_type, 0, 10) == 'audio/mpeg' ) { < $form_fields['showplayer'] = array( < 'label' => __('Insert flash player?'), < 'value' => "true", < 'input' => 'checkbox', < ); < < < } < return $form_fields; < } < add_filter('attachment_fields_to_edit', 'audio_attachment_fields_to_edit', 10, 2); 800c779 < if ( $send ) { --- > if ( $send ) 802d780 < } 839,841d816 < } < elseif ( $field['input'] == 'checkbox' ) { < $item .= "<input type='checkbox' id='$name' name='$name' value='" . attribute_escape( $field['value'] ) . "'" . $aria_required . "/>"; 1382,1387d1356 < <th valign="top" scope="row" class="label"> < <span class="alignleft"><label for="insertonly[showplayer]">' . __('Show Player?') . '</label></span> < </th> < <td class="field"><input id="insertonly[showplayer]" name="insertonly[showplayer]" value="true" type="checkbox" aria-required="false"></td> < </tr> < <tr>
- The topic ‘embedding flash mp3 player, without js’ is closed to new replies.