简体   繁体   English

浏览页面时如何保持音频播放?

[英]How to keep audio playing while navigating through pages?

I am making a website for my friends band. 我正在为我的朋友乐队制作一个网站。 I would like to know if its possible (apart from using Ajax) to keep audio playing after clicking on a link to another page on the site? 我想知道是否有可能(除了使用Ajax之外)单击网站上另一页面的链接后继续播放音频?

I currently have it set up using Ajax to reload the content, but I am having a few issues with it, and I'd rather not deal with the bother unless I really have to. 目前,我已经使用Ajax设置了它来重新加载内容,但是我遇到了一些问题,除非真正需要,我宁愿不去理会。

If not possible, is there a way to minimise the disruption (pausing then playing again) while navigating? 如果不可能,是否有办法在导航时最大程度地减少干扰(暂停然后再次播放)? It would be possible for the new page to continue playing the track from where the last page stopped, but I would like to minimise the pause. 新页面可能会继续播放最后一页停止处的曲目,但我想尽量减少暂停。 Or, on this subject, is it possible to keep certain page elements loaded after changing the URL (without using # urls), like facebook does (as in, you click on it, but the banner never disappears during loading) 或者,就此主题而言,是否可以在更改URL后保持某些页面元素加载(不使用#url),就像facebook一样(例如,单击它,但是横幅在加载过程中永远不会消失)

Thanks for any help :) 谢谢你的帮助 :)

Use Ajax to load content and History API's pushState() to alter URL without page reload. 使用Ajax加载内容,使用History API的pushState()更改URL而无需重新加载页面。

For consistent behavior across browsers, consider using a wrapper library like History.js . 为了在浏览器之间保持一致的行为,请考虑使用类似History.js的包装器库。

Sites like Facebook use JavaScript/AJAX for these kind of things. 诸如Facebook之类的网站将JavaScript / AJAX用于此类事情。 If you don't want to use it, you can use frames (not recommended). 如果您不想使用它,可以使用框架(不推荐)。 Divide the page in two frames: the player and the website itself. 将页面分为两个框架:播放器和网站本身。 This way you can easily turn it off too, just open the site without frames. 这样,您也可以轻松关闭它,只需打开没有框架的站点即可。

Good luck! 祝好运!

Of course you could also pop up the player in another window/tab. 当然,您也可以在另一个窗口/选项卡中弹出播放器。 (For now) It won't be possible without frames or javascript. (目前)没有框架或JavaScript将无法实现。

不同于通过AJAX来实现它可能会很麻烦,但是您可以使用IFrames,在IFrames中播放音乐,而在子菜单中显示内容,也可以始终将其制作为Flash网页。

Build it in Wordpress and use the AnythingSlider plugin to have the pages shift within the main page. 在Wordpress中进行构建,并使用AnythingSlider插件在主页面内移动页面。 This way you can have tabbed navigation and never leave the actual page. 这样,您可以使用选项卡式导航,而永远不会离开实际页面。 No need to write too much code. 无需编写太多代码。 The AnythingSlider uses html for the slides. AnythingSlider对幻灯片使用html。

You can also not use wordpress and just use the AnythingSlider code. 您也不能使用wordpress,而只能使用AnythingSlider代码。

http://css-tricks.com/anythingslider-jquery-plugin/ http://css-tricks.com/anythingslider-jquery-plugin/

and

http://wordpress.org/extend/plugins/anythingslider-for-wordpress/ http://wordpress.org/extend/plugins/anythingslider-for-wordpress/

and

http://css-tricks.com/examples/AnythingSlider/ http://css-tricks.com/examples/AnythingSlider/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM