简体   繁体   English

如何使用变量更改URL

[英]How to change url with variable

I would change the src value with a variable in order to have a channel list to be selected, I thought of a php file but do not know how to set it, to pass a url to the script 我会用一个变量更改src值,以便选择频道列表,我想到了一个php文件,但不知道如何设置它,将url传递给脚本

src: 'http://example.com/streaming/password/playlist.m3u8'

it's possible to do it? 有可能做到吗?

    <script>
        flowplayer('#player', {
          ratio: 0.4167,
          background: true,
          //splash: true,
          clip: {
            title: 'Background video',
            sources: [{
              type: 'application/x-mpegurl',
              src: 'http://example.com/streaming/password/playlist.m3u8'
            }, {
              type: 'video/webm',src: '//stream.flowplayer.org/bauhaus.webm'
        }, {
          type: 'video/mp4',
          src: '//stream.flowplayer.org/bauhaus.mp4'
        }]
      }
    });
    </script>
  </body>
</html>

You can change the src of an element with jQuery. 您可以使用jQuery更改元素的src Like this 像这样

var source = clip.sources.source;
$('#idOfYourElement').attr("src", source);

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

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