AxisCommunications / locomote-video-player

Media Player in Adobe Flash with RTSP support. (THIS PROJECT IS NO LONGER MAINTAINED)
BSD 3-Clause "New" or "Revised" License
133 stars 79 forks source link

Pause() after Resume() doesn't work #137

Closed cherihung closed 4 years ago

cherihung commented 9 years ago

I am playing with this plugin now, playing a flv file locally via http. It's not a real live stream. The bug I encountered is this:

  1. Play()
  2. Pause()
  3. Resume()
  4. Pause() <-- gives error that says cannot pause if the stream is not playing.

It feels like a bug but is it one that would be moot for use on live stream video? My purpose ultimately is to use this plugin for stream RSTP video. I'm simply testing with a local file for style and other dev purpose.

andrewagain commented 8 years ago

I've noticed this issue as well. Seems like a pretty huge issue.

I dug a little deeper. The problem is that if you pause and then resume, the stream status is paused.

Here's a concrete reproduction. You just need to throw this HTML on a server alongside locomote.min.js and Player.swf.

<html>
  <head>
    <title>Locomote</title>
    <style type="text/css">
      #player {
        width: 320px;
        height: 240px;
      }
    </style>
    <script src="locomote.min.js"></script>
    <script type="text/javascript">
      document.addEventListener('DOMContentLoaded', function() {
        console.log('dom loaded');
        var locomote = new Locomote('player', 'Player.swf');
        locomote.on('apiReady', function() {
          console.log('about to play');
          locomote.play('rtmp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov');
        });
        locomote.on('streamStarted', function() {
          console.log('stream has started');
        });
        locomote.on('error', function(err) {
          console.log(err);
        });

        setTimeout(function() {
          console.log('pausing');
          locomote.pause();
          setTimeout(function() {
            console.log('resuming');
            locomote.resume();
            setTimeout(function() {
              console.log('Stream status should be "playing" but instead is: "' + locomote.streamStatus().state + '"');
            }, 2000);
          }, 2000);
        }, 2000);
      });
    </script>
  </head>
  <body>
    <div id="player" class="player"></div>
  </body>
</html>
andrewagain commented 8 years ago

@drowzy I'd love to work on a fix here - any pointers?