Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switching src from flv to mp4 doesn't dispose properly? #1561

Closed
klevenick opened this issue Oct 3, 2014 · 5 comments
Closed

Switching src from flv to mp4 doesn't dispose properly? #1561

klevenick opened this issue Oct 3, 2014 · 5 comments

Comments

@klevenick
Copy link

In my particular instance, we have a playlist setup that dynamically loads videos. If a video requiring Flash is played (in this case, an flv), and then is followed by an mp4 (or some other HTML5 tech), there seems to be a mis-loading of the new player, or something similar. Behind the controls you can see another set of controls loaded.

Switching the other way: from HTML5 to Flash works fine. The expected result should be, I would imagine, the reserve functions the same.

A test case is here (http://jsbin.com/mozawupuceke/1/edit), but the JS Bin doesn't load the FLV properly. Nonetheless, you can still click the Flash button, then click the HTML5 button to see the results. Included below is some test code if you want to see a version with a working FLV.

<script src="video-js-4.9.0/video-js/video.dev.js"></script>
<link href="video-js-4.9.0/video-js/video-js.css" rel="stylesheet"></script>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
</head>
<body>
<video id="test_player" class="video-js vjs-default-skin" controls preload="auto" width="70%" height="70%">

</video>
<button type="button" data-action="prev">html5</button>
<button type="button" data-action="next">flash</button>

<script>
      window.videos = [
        [{
            src: 'http://stream.flowplayer.org/bauhaus/624x260.mp4',
            type: 'video/mp4'
        }],
        [{
            src: 'http://techslides.com/demos/sample-videos/small.flv',
            type: 'video/flv'
        }]
      ];
      window.player = videojs('test_player', { 'autoplay': true });

      $('[data-action=prev]').on('click', function(e) {
        player.src(videos[0]);
      });
      $('[data-action=next]').on('click', function(e) {
        player.src(videos[1]);
      });
</script>
@mmcc
Copy link
Member

mmcc commented Oct 3, 2014

So you're seeing this any time the Flash tech is loaded after a player that uses HTML5? I've seen this issue, but I've only been able to reproduce using a player with the HLS tech loaded, followed by a standard player.

@heff @dmlap - Look familiar?

@klevenick
Copy link
Author

I guess technically it loads as html5 without a video, then switches to Flash when you load the Flash video, then back to html5 when you load that video.

@dmlap
Copy link
Member

dmlap commented Oct 3, 2014

@mmcc yep, we were just chatting about this in IRC moments ago. The issue is here: https://github.com/videojs/video.js/blob/master/src/js/media/html5.js#L89. As in player init, we need to remove the controls attribute from the video element before inserting it into the DOM. Working on a fix.

dmlap added a commit to dmlap/video.js that referenced this issue Oct 3, 2014
Fix for videojs#1561. If the HTML tech is being constructed without a video element to work off of, make sure that the controls attribute is only added under the same circumstances it would be at player init. Before this fix, if you loaded the Flash tech and then switched to the HTML tech, you would see the native controls underneath the video.js controls.
@yadavharsh
Copy link

Were you able to fix it? I am having the same issue.

@heff
Copy link
Member

heff commented Dec 8, 2014

@yadavharsh, this is just waiting on @dmlap's #1564 pull request. You could build a copy of the library using his branch and see if that works for you.

dmlap added a commit to dmlap/video.js that referenced this issue Jan 19, 2015
Fix for videojs#1561. If the HTML tech is being constructed without a video element to work off of, make sure that the controls attribute is only added under the same circumstances it would be at player init. Before this fix, if you loaded the Flash tech and then switched to the HTML tech, you would see the native controls underneath the video.js controls.
@dmlap dmlap closed this as completed in 4bde5c8 Jan 23, 2015
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants