{"action":"opened","issue":{"url":"https://api.github.com/repos/Temasys/AdapterJS/issues/57","labels_url":"https://api.github.com/repos/Temasys/AdapterJS/issues/57/labels{/name}","comments_url":"https://api.github.com/repos/Temasys/AdapterJS/issues/57/comments","events_url":"https://api.github.com/repos/Temasys/AdapterJS/issues/57/events","html_url":"https://github.com/Temasys/AdapterJS/issues/57","id":65787439,"number":57,"title":"Rework attachMediaStream() plugin implementation for better integration","user":{"login":"soulhunter1987","id":2089893,"avatar_url":"https://avatars.githubusercontent.com/u/2089893?v=3","gravatar_id":"","url":"https://api.github.com/users/soulhunter1987","html_url":"https://github.com/soulhunter1987","followers_url":"https://api.github.com/users/soulhunter1987/followers","following_url":"https://api.github.com/users/soulhunter1987/following{/other_user}","gists_url":"https://api.github.com/users/soulhunter1987/gists{/gist_id}","starred_url":"https://api.github.com/users/soulhunter1987/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soulhunter1987/subscriptions","organizations_url":"https://api.github.com/users/soulhunter1987/orgs","repos_url":"https://api.github.com/users/soulhunter1987/repos","events_url":"https://api.github.com/users/soulhunter1987/events{/privacy}","received_events_url":"https://api.github.com/users/soulhunter1987/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-01T21:54:28Z","updated_at":"2015-04-01T21:54:28Z","closed_at":null,"body":"It is general practice to hide the orignal element with style=\"display:none\", not remove completely. Then you could restore it easily, and all of it's properties (even changed while working with plugin) would be preserved.\r\nCurrently, yes, we have such a use case: by default video tag is opaque and user sees a picture behind it. When a call starts - peer's stream it attached to this video element. When a call ends video tag should becomes opaque again (that's why we need to detach media stream from it). And between calls some video files may be played in this video tag. Of course we could just replace video tag with a new one every time, but i think it is a bad approach.\r\nAlso, this approach might be helpful in listening to video element events. For example, you hide video element and listen to it's \"volumechange\" event to enable/disable stream audio tracks. That would solve #34. So generally, user interracts with original video element, and you just proxy it's events to your plugin in some way. Of couse this approach needs investigation and testing, but i find it possible and perspective.\r\n\r\nConserning ID management:\r\n\r\nUsually it is done this way: you leave original ID on it's place, and set ID of your inserted content to something like 'ID_plugin'. Then, when user want to manipulate original element some way - he can get it by original ID and does not get any mess. But when he uses attachMediaStream(), for example (calls one of your API methods), this method transparetly converts ID to ID_plugin and takes actions in favor of your inserted content.\r\nGeneral idea here is that you transparently insert some new content and user (developer) even doesn't notice that, when working with original element's or your plugin's public API.\r\nFor example, in method \"attachMediaStream\" it could look like this:\r\n\r\nfunction attachMediaStream(element, stream) {\r\nvar object_element = document.getElementById(element.id + '_plugin');\r\nelement = object_element;\r\n...\r\n"}}