非常基本的JS编码,和SoundManager2或不? [英] Very Basic JS Coding, and SoundManager2 or not?

查看:80
本文介绍了非常基本的JS编码,和SoundManager2或不?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的网站上添加一个音频/可能的视频播放器,其中包含以下属性:




  • 必须通过< $ c $< div> ;

  • 通过CSS进行样式设置; 可以读取所有ID3信息; / li>


  • 可以从数据库中提取文件(可能是GoDaddy的Easy Database)到智能手机等。


    我已被推荐到SoundManager2,看起来符合法案,但我似乎在制作真正的麻烦一个可点击的图像开始播放我的MP3。我没有JS技能,所以我要从愚蠢的基础中慢慢建立起来。我想我有两个问题:


    1. 是否还有其他媒体播放器更适合?

    2. 我现在还无法创建小提琴,但这是非常简单的HTML - 出了什么问题?:

       < HTML> 
      < head>

      < script src =script / soundmanager2.js>< / script>

      < script>

      // Flash文件的路径
      soundManager.url ='swf /';
      soundManager.onload(function(){
      // SM2准备播放音频

      //创建mySound
      soundManager.createSound({
      id:mySound,
      url:audiofiles / my.mp3,
      onfinish:function(){window.location.href ='index.html}});
      } ;

      //播放文件
      //soundManager.play('mySound','my.mp3');});
      < / script>

      < / head>

      < body>
      < / body>
      < / html>


    我从另一个网站,但我有一个鬼鬼祟祟的怀疑,该代码是不完整的,所以任何帮助将是...犯错...有帮助。

    解决方案

    我操作网站,你说你拿了代码。我更新了它,它应该工作。确保您在教程中这两个部分。第二部分假定您使用的是与第一个相同的文件结构。这应该现在的工作completley罚款:



    HTTP:/ /en.wikiaudio.org/SoundManager2:How_to_play_and_trigger_sound


    I would like to include an audio/possible video player on my website with the following attributes:

    • Must be placeable via a <div>;
    • Styled via CSS;
    • Can read all ID3 info;
    • Can pull the file from a database (probably GoDaddy's Easy Database);
    • No flash;
    • Transferrable to smartphones etc.

    I have been herded to SoundManager2 which appears to fit the bill, but I seem to be having real trouble just making a clickable image to begin playing my mp3. I have zero JS skills so am going from silly basic and building up slowly. I suppose I have two questions:

    1. Is there another media player that is better suited?
    2. I can't create a Fiddle with what I have so far, but this is the very simple HTML - what is going wrong?:

      <html>
      <head>
      
      <script src="script/soundmanager2.js"></script>
      
      <script>
      
      // Path to Flash Files
      soundManager.url = 'swf/';
      soundManager.onload(function(){
        // SM2 is ready to Play Audio
      
      // Create "mySound"
      soundManager.createSound({
      id:"mySound",
      url:"audiofiles/my.mp3",
      onfinish:function(){window.location.href='index.html}});
      };
      
      // Play File
      //soundManager.play('mySound','my.mp3');});
      </script>
      
      </head>
      
      <body>
      <img src="image.jpg" alt="Previous" border="0" width="400" height="400" onclick="soundManager.play('mySound',{volume:100})";>
      </body>
      </html>
      

    I had copied this code from another website, but I have a sneaking suspicion that the code was incomplete, so any help would be...err...helpful.

    解决方案

    I operate the website you say you took the code from. I updated it and it should work. Make sure you do both sections in the tutorial. The second section assumes that you are using the same file structure as the first. This should work completley fine now:

    http://en.wikiaudio.org/SoundManager2:How_to_play_and_trigger_sound

    这篇关于非常基本的JS编码,和SoundManager2或不?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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