如何使用 flowplayer (jQuery) 叠加多个视频

发布于 2024-12-20 15:17:41 字数 2234 浏览 1 评论 0原文

无法使用带有 jQ​​uery 的 flowplayer 执行多个叠加视频

我做了单个叠加视频,但当我尝试执行多个叠加时没有得到结果 我认为脚本可能有问题,我不知道 jQuery 请帮助我

我的代码是

     <style>

    .overlay {
     background:url(white.png) no-repeat;
     padding:40px;
     width:576px;
     display:none;
     }

    .close {
     background:url(close.png) no-repeat;
     position:absolute;
     top:2px;
     display:block;
      right:5px;
      width:35px;
      height:35px;
      cursor:pointer;
     }

     a.player  {
     display:block;
     height:450px;
      } 

      </style>

       <script>

    $(function() 
     {

    //setup overlay actions to anchors
    $("a[rel]").overlay({

    // use the Apple effect for overlay
    effect: 'apple',
     expose: '#789',
     onLoad: function(content) {

    // find the player contained inside this overlay and load it
     this.getOverlay().find("a.player").flowplayer(0).load();

     },
    onClose: function(content) {
    $f().unload();
    }
     });

    // install flowplayers
    $("a.player").flowplayer("http://releases.flowplayer.org/swf/flowplayer-3.2.7.swf");
    });

  </script>

     <body>

    <p>

    <a rel="overlay1" href="#">
<img src="image1.png" />
 </a>

     <a rel="overlay2" href="#">
<img src="image2.png"/>
 </a>

     <a rel="overlay3" href="#">
<img src="image3.png" />
 </a>

     <a rel="overlay4" href="#">
<img src="image4.png"/>
 </a>

     </p>

     </body>

    <div id="overlay1" class="overlay" style="background-image:url('white.png')">
 <a id="player" href="video.mp4">
&nbsp;
</a>
</div>

     <div id="overlay2" class="overlay" style="background-image:url('white.png')">
     <a id="player" href="video.mp4">
 &nbsp;
 </a>
 </div>

     <div id="overlay3" class="overlay" style="background-image:url('white.png')">
     <a id="player" href="video.mp4">
 &nbsp;
 </a>
 </div>

     <div id="overlay4" class="overlay" style="background-image:url('white.png')">
     <a id="player" href="video.mp4">
 &nbsp;
 </a>
 </div>

Unable to do multiple overlayed videos using flowplayer with jQuery

I did single overlayed video, but i don't get result when i try to do multiple overlays
I think there may be problem with Script and i don't know jQuery please help me

My code is

     <style>

    .overlay {
     background:url(white.png) no-repeat;
     padding:40px;
     width:576px;
     display:none;
     }

    .close {
     background:url(close.png) no-repeat;
     position:absolute;
     top:2px;
     display:block;
      right:5px;
      width:35px;
      height:35px;
      cursor:pointer;
     }

     a.player  {
     display:block;
     height:450px;
      } 

      </style>

       <script>

    $(function() 
     {

    //setup overlay actions to anchors
    $("a[rel]").overlay({

    // use the Apple effect for overlay
    effect: 'apple',
     expose: '#789',
     onLoad: function(content) {

    // find the player contained inside this overlay and load it
     this.getOverlay().find("a.player").flowplayer(0).load();

     },
    onClose: function(content) {
    $f().unload();
    }
     });

    // install flowplayers
    $("a.player").flowplayer("http://releases.flowplayer.org/swf/flowplayer-3.2.7.swf");
    });

  </script>

     <body>

    <p>

    <a rel="overlay1" href="#">
<img src="image1.png" />
 </a>

     <a rel="overlay2" href="#">
<img src="image2.png"/>
 </a>

     <a rel="overlay3" href="#">
<img src="image3.png" />
 </a>

     <a rel="overlay4" href="#">
<img src="image4.png"/>
 </a>

     </p>

     </body>

    <div id="overlay1" class="overlay" style="background-image:url('white.png')">
 <a id="player" href="video.mp4">
 
</a>
</div>

     <div id="overlay2" class="overlay" style="background-image:url('white.png')">
     <a id="player" href="video.mp4">
  
 </a>
 </div>

     <div id="overlay3" class="overlay" style="background-image:url('white.png')">
     <a id="player" href="video.mp4">
  
 </a>
 </div>

     <div id="overlay4" class="overlay" style="background-image:url('white.png')">
     <a id="player" href="video.mp4">
  
 </a>
 </div>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

依 靠 2024-12-27 15:17:41

您的链接中缺少 # 符号。你需要其中两个。一个是 href="#" - 您有,另一个是 rel="#overlay1" - 您没有。例如:

<a rel="#overlay1" href="#">Video 1</a>

<a rel="#overlay2" href="#">Video 2</a>

<a rel="#overlay3" href="#">Video 3</a>

<a rel="#overlay4" href="#">Video 4</a>

You're missing the # sign in your links. You need two of them. One being href="#" - which you have, the other being rel="#overlay1" - which you don't. For example:

<a rel="#overlay1" href="#">Video 1</a>

<a rel="#overlay2" href="#">Video 2</a>

<a rel="#overlay3" href="#">Video 3</a>

<a rel="#overlay4" href="#">Video 4</a>
你如我软肋 2024-12-27 15:17:41

最初,我看到的最明显的事情是,您正在调用 Flowplayer 来初始化具有“玩家”类别的 A 标签上的玩家,但您的 A 标签是用“玩家”ID 而不是类别写入的。

Initially, the most obvious thing I see is that you're calling Flowplayer to initialize players on A tags with a CLASS of "player", but your A tags are written with IDs of "player" and not CLASSes.

爱你是孤单的心事 2024-12-27 15:17:41

更好的脚本:

CSS

<style type="text/css">
/* <![CDATA[ */
    #overlay {
      display: none;
      padding: 70px;
      width: 512px;
      background-image:url(http://flowplayer.org/media/img/overlay/white.png);
    }
    .close {
     background:url(http://flowplayer.org/media/img/overlay/close.png) no-repeat;
      position:absolute;
      top:2px;
      right:5px; 
      display:block;
      width:35px;
      height:35px;
      cursor:pointer;
    }
    #player {
      display: block;
      width: 512px;
      height: 384px;
      margin: 0;
    }
    #player *:focus {
      outline-style: none;
    }
  /* ]]> */
  </style>

JAVASCRIPT

<script type="text/javascript">
// <![CDATA[
  $(function () {
    var player = $f("player", "/flowplayer-3.2.15.swf", {
      clip: {
        baseUrl: "http://media.blacktrash.org",
        scaling: "fit"
      }
    });

    $("a[rel]").overlay({
      mask: {
        color: '#000',
        opacity: 0.2
      },
      onLoad: function () {
        player.play(this.getTrigger().attr("href"));
      },
      onClose: function () {
        player.unload();
      }
    });
  });
  // ]]>
  </script>

HTML

<ul>
    <li><a rel="#overlay" href="ccc_trailer1.mp4">Video 1</a></li>

    <li><a rel="#overlay" href="ccc_trailer2.mp4">Video 2</a></li>

    <li><a rel="#overlay" href="ccc.mp4">Video 3</a></li>

    <li><a rel="#overlay" href="stsp.mp4">Video 4</a></li>

    <li><a rel="#overlay" href="manstalt.mp4">Video 5</a></li>
  </ul>

  <div id="overlay">
    <a class="close"></a>

    <div id="player"> </div>
  </div>

Better Script for this:

CSS

<style type="text/css">
/* <![CDATA[ */
    #overlay {
      display: none;
      padding: 70px;
      width: 512px;
      background-image:url(http://flowplayer.org/media/img/overlay/white.png);
    }
    .close {
     background:url(http://flowplayer.org/media/img/overlay/close.png) no-repeat;
      position:absolute;
      top:2px;
      right:5px; 
      display:block;
      width:35px;
      height:35px;
      cursor:pointer;
    }
    #player {
      display: block;
      width: 512px;
      height: 384px;
      margin: 0;
    }
    #player *:focus {
      outline-style: none;
    }
  /* ]]> */
  </style>

JAVASCRIPT

<script type="text/javascript">
// <![CDATA[
  $(function () {
    var player = $f("player", "/flowplayer-3.2.15.swf", {
      clip: {
        baseUrl: "http://media.blacktrash.org",
        scaling: "fit"
      }
    });

    $("a[rel]").overlay({
      mask: {
        color: '#000',
        opacity: 0.2
      },
      onLoad: function () {
        player.play(this.getTrigger().attr("href"));
      },
      onClose: function () {
        player.unload();
      }
    });
  });
  // ]]>
  </script>

HTML

<ul>
    <li><a rel="#overlay" href="ccc_trailer1.mp4">Video 1</a></li>

    <li><a rel="#overlay" href="ccc_trailer2.mp4">Video 2</a></li>

    <li><a rel="#overlay" href="ccc.mp4">Video 3</a></li>

    <li><a rel="#overlay" href="stsp.mp4">Video 4</a></li>

    <li><a rel="#overlay" href="manstalt.mp4">Video 5</a></li>
  </ul>

  <div id="overlay">
    <a class="close"></a>

    <div id="player"> </div>
  </div>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文