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

LoadedAllData event fails to fire after Flash file played #1676

Closed
ds00424 opened this issue Nov 19, 2014 · 6 comments
Closed

LoadedAllData event fails to fire after Flash file played #1676

ds00424 opened this issue Nov 19, 2014 · 6 comments

Comments

@ds00424
Copy link

ds00424 commented Nov 19, 2014

In the below sample code below (insert your favorite flv and mp4 files), the flv will load and play, and then the mp4 will load but not play. It seems the LoadedAllData event fails to fire after the flv is loaded/played.

Heff points to a bug. See:
http://stackoverflow.com/questions/26985646/video-js-loadedalldata-firing-only-once

Here is the jist of that post (just in case):
This line of code turns the events off as soon as the buffer reaches 100%, but then never resets itself on a later source load.

if (bufferedPercent === 1) {

It should restart these events when the loadstart event is fired again by the flash player, signaling a new source has been loaded.

My sample code:

<html>
  <head>
    <link type="text/css" href="/js/video.js/video-js.css" rel="stylesheet" />
    <script type="text/javascript" src="/js/jquery/jquery-2.1.1.min.js"></script>
    <script type="text/javascript" src="/js/video.js/video.js"></script>

    <script>
        videojs.options.flash.swf = "/js/video.js/video-js.swf"
        $(document).ready(function () {
            var playIt = function playVid() {
                alert("Event");
                this.play();
            }

            videojs("video1", {}, function(){
                this.on('loadedalldata', playIt);
                this.on('ended', function() {
                    this.src({ type: "video/mp4", src: "/files/test.mp4" });
                    this.load();
                });
                this.src({ type: "video/flv", src: "/files/barsandtone.flv" });
                this.load();
            });
        });
    </script>
  </head>
  <body>
    <div id="div1">
        <video id="video1" class="video-js vjs-default-skin"></video>
    </div>
  </body>
</html>
@yadavharsh
Copy link

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

@ds00424
Copy link
Author

ds00424 commented Dec 6, 2014

Try the loadeddata event.
But I changed my approach slightly. For mp4 I use native html5 but for flv I use video.js. (my application is using a dedicated client on an embedded system so i have control over which browser is used).

hth

@mmcc
Copy link
Member

mmcc commented Dec 12, 2014

Sorry about the delay! Added this as confirmed and we'll take a look at getting this resolved next week.

@okwme
Copy link

okwme commented Feb 12, 2015

any updates on this issue? running into it myself while using the videojs-contrib-ads plugin

@heff
Copy link
Member

heff commented Apr 1, 2015

I think we need to deprecate the loadedalldata event for 5.0. It's a made up event (not from the video element) that has less use these days for a few reasons:

  • For most cases, you should use the canplaythrough event instead of loadedalldata.
  • Browsers manage their buffer more carefully now, they don't just load the whole video at once
  • It doesn't apply to live events

Any objections to doing that?

@mmcc
Copy link
Member

mmcc commented Apr 1, 2015

Kill it with fire.

@heff heff added this to the v5.0.0 milestone Sep 14, 2015
@heff heff closed this as completed in 4cb7687 Sep 15, 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