最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Can HTML embed<> stop mp3s from automatically downloading? - Stack Overflow

programmeradmin1浏览0评论

I have lots of mp3s on my site that I want my friends to be able to play only- but I don't want them all downloading as soon as the page opens and would prefer them to only start downloading into the buffer if someone wants to play it- is this possible with the embed tag? I can't seem to find anything on Google so I am wondering if it's something I'll have to do in JavaScript or think of an HTML work around.

cheers

I have lots of mp3s on my site that I want my friends to be able to play only- but I don't want them all downloading as soon as the page opens and would prefer them to only start downloading into the buffer if someone wants to play it- is this possible with the embed tag? I can't seem to find anything on Google so I am wondering if it's something I'll have to do in JavaScript or think of an HTML work around.

cheers

Share Improve this question edited Oct 24, 2008 at 18:20 swilliams 49k27 gold badges102 silver badges130 bronze badges asked Oct 24, 2008 at 18:12 greggreg 1
  • Do you have to use an Embed Tag, or are you open to JS only solutions? – BigBlondeViking Commented Aug 18, 2009 at 15:23
Add a ment  | 

5 Answers 5

Reset to default 4

You can use javascript to construct the embeds and insert them into the DOM when a user clicks a button or something similar.

You will want to use the Object tag vs. the Embed tag for one, but that said, don't set the auto-play option and they won't load until requested.

If you want a really simple fix - don't embed the music files just have links to them. Then a user won't have the file download until they click on them (this is what blog.stackoverflow. does for the podcasts...).

If you have time on your hands you can go for my solution... I created a separate html page for each song and used the embed tag on each. Then I just created links to the pages to open in a new window. I know... hack! But it works well, and the other related links go along with it in the new window for each song.

You could always try out Yahoo Media Player,

You just make link to the mp3s and they can play them at their own pace.

I have seen this used for PodCasts, and Playlists of Mp3s its very handy and free.

http://mediaplayer.yahoo./

<a href="http://mediaplayer.yahoo./example1.mp3">First link</a>
<a href="http://mediaplayer.yahoo./example2.mp3">Second link</a>
<a href="http://mediaplayer.yahoo./example3.mp3">Third link</a>


<script type="text/javascript" src="http://mediaplayer.yahoo./js"></script>

Simple :)

You can even add album art and manipulate the order the mp3s are added to the playlist thru simple html.

http://yahoomediaplayer.wikia./wiki/How_to_link

发布评论

评论列表(0)

  1. 暂无评论