{"action":"created","issue":{"url":"https://api.github.com/repos/eXon/videojs-youtube/issues/265","labels_url":"https://api.github.com/repos/eXon/videojs-youtube/issues/265/labels{/name}","comments_url":"https://api.github.com/repos/eXon/videojs-youtube/issues/265/comments","events_url":"https://api.github.com/repos/eXon/videojs-youtube/issues/265/events","html_url":"https://github.com/eXon/videojs-youtube/issues/265","id":76017489,"number":265,"title":"Ask plugin if given source is supported url format","user":{"login":"pgtaboada","id":1474196,"avatar_url":"https://avatars.githubusercontent.com/u/1474196?v=3","gravatar_id":"","url":"https://api.github.com/users/pgtaboada","html_url":"https://github.com/pgtaboada","followers_url":"https://api.github.com/users/pgtaboada/followers","following_url":"https://api.github.com/users/pgtaboada/following{/other_user}","gists_url":"https://api.github.com/users/pgtaboada/gists{/gist_id}","starred_url":"https://api.github.com/users/pgtaboada/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pgtaboada/subscriptions","organizations_url":"https://api.github.com/users/pgtaboada/orgs","repos_url":"https://api.github.com/users/pgtaboada/repos","events_url":"https://api.github.com/users/pgtaboada/events{/privacy}","received_events_url":"https://api.github.com/users/pgtaboada/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-13T15:05:25Z","updated_at":"2015-05-18T14:58:22Z","closed_at":null,"body":"hi,\r\n\r\nvideo.js asks via \"canPlay\" if a given source object can be played. I would like to extend that method so that if no type is provided, a reggex is used.\r\n\r\nIs there any way to easily implement this, so I don't have to duplicate the test code?\r\n\r\nfor the vimeo plugin I solved it this way:\r\n\r\n```javascript\r\nvideojs.Vimeo.canPlaySource = function(srcObj){\r\n  if (srcObj.type)  \r\n      return (srcObj.type == 'video/vimeo');\r\n  else {\r\n      var regExp = /^.*(vimeo\\.com\\/)((channels\\/[A-z]+\\/)|(groups\\/[A-z]+\\/videos\\/))?([0-9]+)/;\r\n      var match = srcObj.src.match(regExp);\r\n\r\n      return (match)\r\n  }\r\n};\r\n```"},"comment":{"url":"https://api.github.com/repos/eXon/videojs-youtube/issues/comments/103086824","html_url":"https://github.com/eXon/videojs-youtube/issues/265#issuecomment-103086824","issue_url":"https://api.github.com/repos/eXon/videojs-youtube/issues/265","id":103086824,"user":{"login":"eXon","id":280982,"avatar_url":"https://avatars.githubusercontent.com/u/280982?v=3","gravatar_id":"","url":"https://api.github.com/users/eXon","html_url":"https://github.com/eXon","followers_url":"https://api.github.com/users/eXon/followers","following_url":"https://api.github.com/users/eXon/following{/other_user}","gists_url":"https://api.github.com/users/eXon/gists{/gist_id}","starred_url":"https://api.github.com/users/eXon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eXon/subscriptions","organizations_url":"https://api.github.com/users/eXon/orgs","repos_url":"https://api.github.com/users/eXon/repos","events_url":"https://api.github.com/users/eXon/events{/privacy}","received_events_url":"https://api.github.com/users/eXon/received_events","type":"User","site_admin":false},"created_at":"2015-05-18T14:58:22Z","updated_at":"2015-05-18T14:58:22Z","body":"I was trying to check when `canPlaySource` is called and your else will never happen. The reason is if we don't have a type, it will not even check. It makes sense for regular videos but not for 3rd party services.\r\n\r\nI think I know a great way to do that so I will propose a fix to them so `canPlaySource` can get called and we'll see what they think."}}