如何使用Asp.Net在所有打开页面上暂停所有播放音频 [英] How I Can Pause All Playing Audio On All Opening Pages Using Asp.Net

查看:123
本文介绍了如何使用Asp.Net在所有打开页面上暂停所有播放音频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在新标签上播放新音频时,如何在所有打开的页面上暂停所有播放的音频

我希望音频播放方式为soundcloud.com

谢谢

我正在使用这个播放器

 <   audio     controls  >  
< source src = horse.mp3 type = audio / mpeg >
< / audio >

解决方案

如果您参考http://www.w3schools.com/tags/ref_av_dom.asp [ ^ ]有方法列表。例如,暂停()



如果所有玩家都使用相同的JavaScript打开,那么只需保留对它们的引用,然后就可以访问每个玩家。

我有专辑页面包含多个播放器,我通过此代码暂停所有播放器的专辑页面

 Pu =  function ()
{
var lis = document .getElementsByTagName(' audio');
for var i = 0 ; i< lis.length; i ++)
{
var item = lis [i];
item.pause();
}
}



但是我需要一个代码来暂停所有打开页面中的所有玩家。


hi, how i can pause all playing audio on all opening pages when I play the new audio on new tab
I want audio playing way as The way on "soundcloud.com"
Thank you
I am using this player

<audio controls>
  <source src="horse.mp3" type="audio/mpeg">
</audio>

解决方案

If you refer to http://www.w3schools.com/tags/ref_av_dom.asp[^] there is the list of methods. For example, pause()

If all your players were opened by the same JavaScript then just keep a reference to them and then you can access each player.


I have page for album it's Include Multiple player, I pause all player's in album page by this code

Pu = function ()
{
    var lis = document.getElementsByTagName('audio');
    for (var i = 0; i < lis.length; i++)
    {
        var item = lis[i];
        item.pause();
    }
}


but I need a code to pause all players in the all open page.


这篇关于如何使用Asp.Net在所有打开页面上暂停所有播放音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆