{"action":"created","issue":{"url":"https://api.github.com/repos/videojs/videojs-contrib-hls/issues/310","labels_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/issues/310/labels{/name}","comments_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/issues/310/comments","events_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/issues/310/events","html_url":"https://github.com/videojs/videojs-contrib-hls/issues/310","id":88739743,"number":310,"title":"loadstart event should always come before loadedmetadata event","user":{"login":"vasklund","id":5039480,"avatar_url":"https://avatars.githubusercontent.com/u/5039480?v=3","gravatar_id":"","url":"https://api.github.com/users/vasklund","html_url":"https://github.com/vasklund","followers_url":"https://api.github.com/users/vasklund/followers","following_url":"https://api.github.com/users/vasklund/following{/other_user}","gists_url":"https://api.github.com/users/vasklund/gists{/gist_id}","starred_url":"https://api.github.com/users/vasklund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vasklund/subscriptions","organizations_url":"https://api.github.com/users/vasklund/orgs","repos_url":"https://api.github.com/users/vasklund/repos","events_url":"https://api.github.com/users/vasklund/events{/privacy}","received_events_url":"https://api.github.com/users/vasklund/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/videojs/videojs-contrib-hls/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-16T14:11:09Z","updated_at":"2015-06-26T22:55:27Z","closed_at":null,"body":"The `loadstart` event does not always happen before the `loadedmetadata` event, which is the expected behavior. This causes problems for example when trying to override the playlist selection, as discussed in #277. You can see the problem in action at http://output.jsbin.com/haheco/1/ (I can reproduce the problem around 50% of the time).\r\n\r\nToday `loadstart` is triggered in Flash ([HTTPVideoProvider:initNetConnection](https://github.com/videojs/video-js-swf/blob/v4.7.0/src/com/videojs/providers/HTTPVideoProvider.as#L434)), and `loadedmetadata` is triggered in both HLS JS ([playlists.on('loadedmetadata') handler](https://github.com/videojs/videojs-contrib-hls/blob/v0.17.2/src/videojs-hls.js#L116)) and Flash ([HTTPVideoProvider:onMetaData](https://github.com/videojs/video-js-swf/blob/v4.7.0/src/com/videojs/providers/HTTPVideoProvider.as#L650)). My understanding is that we want to trigger `loadstart` right before we start downloading the playlists at [videojs-hls.js#L108](https://github.com/videojs/videojs-contrib-hls/blob/v0.17.2/src/videojs-hls.js#L108), but that would mean moving that logic from Flash to JS. It would make sense to only trigger `loadedmetadata` from JS too, as the event triggers twice today.\r\n\r\nI'm not sure what other implications/issues apart from #277 there are, but nonetheless this seems like it could cause more problems down the road. I'm not sure how this problem should be approached (it seems code changes are needed both in Flash and contrib HLS), but I wanted to highlight the issue and also ask for feedback in case I'm misunderstanding something."},"comment":{"url":"https://api.github.com/repos/videojs/videojs-contrib-hls/issues/comments/115911802","html_url":"https://github.com/videojs/videojs-contrib-hls/issues/310#issuecomment-115911802","issue_url":"https://api.github.com/repos/videojs/videojs-contrib-hls/issues/310","id":115911802,"user":{"login":"dcrockwell","id":53482,"avatar_url":"https://avatars.githubusercontent.com/u/53482?v=3","gravatar_id":"","url":"https://api.github.com/users/dcrockwell","html_url":"https://github.com/dcrockwell","followers_url":"https://api.github.com/users/dcrockwell/followers","following_url":"https://api.github.com/users/dcrockwell/following{/other_user}","gists_url":"https://api.github.com/users/dcrockwell/gists{/gist_id}","starred_url":"https://api.github.com/users/dcrockwell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcrockwell/subscriptions","organizations_url":"https://api.github.com/users/dcrockwell/orgs","repos_url":"https://api.github.com/users/dcrockwell/repos","events_url":"https://api.github.com/users/dcrockwell/events{/privacy}","received_events_url":"https://api.github.com/users/dcrockwell/received_events","type":"User","site_admin":false},"created_at":"2015-06-26T22:55:27Z","updated_at":"2015-06-26T22:55:27Z","body":"+1 this is blocking #277, which in turn is blocking our team."}}