网络风暴:'在浏览器中打开'功能故障

WebStorm: 'Open in Browser' feature malfunction

本文关键字:功能故障 浏览器 风暴 网络      更新时间:2023-09-26

我有下面的一段示例代码。简单的页面,使用JS插件JWPlayer播放视频,一键在视频中执行查找操作。

<html>
     <head>
          <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
          <script src="lib/js/jwplayer-7.1.4/jwplayer.js"></script>
          <script>jwplayer.key="01yIIa/jGb0bj60C14JSO8oxFHJardSr8Bn/4Q==";</script>
          <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
     </head>
     <body>
          <!-- Loading into the JWPlayer, div ID must be unique -->
          <div id="myElement">Loading the player...</div>
          <div id="seek" style="width: 30px; height: 30px; background-color: red;"></div>
           <script type="text/javascript">
                var playerInstance = jwplayer("myElement");
                playerInstance.setup({
                     file: "lib/video/sample.mp4",
                     controls : false
                });

                $('#seek').on('click', function() {
                     //Performs seek 10 seconds ahead
                     playerInstance.seek(playerInstance.getPosition() + 10); 
                });
          </script>
     </body>
</html>

问题:

如果我使用文件的完整路径打开页面,一切都会很好——比如说file:///C:/Users/./index.html。我可以执行查找操作。每次我按下搜索按钮,视频都会向前移动10秒(在所有浏览器中)。但是如果我使用WebStorm中的"在浏览器中打开"功能打开文件,比如说使用地址http://localhost:63342/./index.html。Chrome和Opera中的查找操作出现故障。在这种情况下,当我按下搜索按钮时,视频会从头开始重新播放。

你知道这可能会发生什么吗?这两个怎么会不同呢?

这是内置Web服务器的问题;请投票支持WEB-19331