Skip to content

fix loadedmetada disabled#71

Open
SzHeJason wants to merge 2 commits intospchuang:masterfrom
SzHeJason:master
Open

fix loadedmetada disabled#71
SzHeJason wants to merge 2 commits intospchuang:masterfrom
SzHeJason:master

Conversation

@SzHeJason
Copy link

No description provided.

// player.on("loadedmetadata", function() {
// initialize();
// });
player.ready(function(){
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Does .ready guarantee the duration information has been loaded? My guess is that @spchuang had this listening to loadedmetadata for that reason.

@spchuang
Copy link
Owner

@SzHeJason can you explain more what issue does using 'player.ready' solve?

@SzHeJason
Copy link
Author

Sorry,My english is poor . Can't listen LoadedMetaData event when using this plugin. I think it should not ban any native event.

@SzHeJason
Copy link
Author

player.ready is working in my project , Maybe it's a bad fixed

@spchuang
Copy link
Owner

can you try something like this..

player.ready(function(){
    if (player.readyState && player.readyState() > 0) {
      initialize();
    } else {
      player.on("loadedmetadata", function() {
        initialize();
      });
    }
  });

And what browser are you on? And what video (flash, html5) are you playing?

Thanks

@SzHeJason
Copy link
Author

If register loadedmetadata event to setup plugin, you must turn off loadedmetadata event in player.Still can‘t listen loadedmetadata in player

Video : HTML5
System : macOS
Browser : Chrome 63.0.3239.84

Copy link

@monsieurludo monsieurludo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Off loadedmetadata event listener should just be tied to initialize function to avoid issues with playlists handling where loadedmetada must refresh cues each time on loadedmetadata

// player.on("loadedmetadata", function() {
// initialize();
// });
player.ready(function(){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what needs to be done to isolate the off loadedmetadata event listener to any other loadedmetadata listeners:
function initialize() {
if (setting.markerTip.display) {
initializeMarkerTip();
}

    // remove existing markers if already initialized
    player.markers.removeAll();
    addMarkers(setting.markers);

    onTimeUpdate();
    player.on("timeupdate", onTimeUpdate);
    player.off("loadedmetadata", initialize);
  }

  // setup the plugin after we loaded video's meta data
  player.on("loadedmetadata", initialize);

Copy link

@monsieurludo monsieurludo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Playlist management by detaching loadedmetadata to any other loadedmetadata event listeners

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants