微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

基于JavaScript实现简单的音频播放功能

效果如下:

由于我这边不需要其他按钮,就没写

数据是由后台提供,在这做了个小列子

后台代码

rush:js;"> public ActionResult MusicPlayer(int musicId=0) { MusicPlayerModel model = new MusicPlayerModel(); switch (musicId) { default: model.MusicName = "Believe-动画《海贼王》"; model.CoverImg = "/Content/Music/Believe-cover.jpg"; model.FileUrl = "/Content/Music/Believe.mp3"; model.MusicStartSecond = 0; model.MusicEndSecond = 227; break; case 1: model.MusicName = "梦回还-动画《狐妖小红娘》"; model.CoverImg = "/Content/Music/梦回还-cover.jpg"; model.FileUrl = "/Content/Music/梦回还.mp3"; model.MusicStartSecond = 0; model.MusicEndSecond = 250; break; } return View(model); }

页面代码

rush:js;"> @using FunctionTest.Web.Areas.Function.Models; @model MusicPlayerModel @{ ViewBag.Title = "MusicPlayer"; Layout = "~/Areas/Function/Views/Shared/_FunctionLayout.cshtml"; }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐