{"action":"created","issue":{"url":"https://api.github.com/repos/sarxos/webcam-capture/issues/383","labels_url":"https://api.github.com/repos/sarxos/webcam-capture/issues/383/labels{/name}","comments_url":"https://api.github.com/repos/sarxos/webcam-capture/issues/383/comments","events_url":"https://api.github.com/repos/sarxos/webcam-capture/issues/383/events","html_url":"https://github.com/sarxos/webcam-capture/issues/383","id":101262564,"number":383,"title":"getWebcamByName problem.","user":{"login":"Bazmundi","id":1772587,"avatar_url":"https://avatars.githubusercontent.com/u/1772587?v=3","gravatar_id":"","url":"https://api.github.com/users/Bazmundi","html_url":"https://github.com/Bazmundi","followers_url":"https://api.github.com/users/Bazmundi/followers","following_url":"https://api.github.com/users/Bazmundi/following{/other_user}","gists_url":"https://api.github.com/users/Bazmundi/gists{/gist_id}","starred_url":"https://api.github.com/users/Bazmundi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bazmundi/subscriptions","organizations_url":"https://api.github.com/users/Bazmundi/orgs","repos_url":"https://api.github.com/users/Bazmundi/repos","events_url":"https://api.github.com/users/Bazmundi/events{/privacy}","received_events_url":"https://api.github.com/users/Bazmundi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sarxos/webcam-capture/labels/other","name":"other","color":"d7e102"},{"url":"https://api.github.com/repos/sarxos/webcam-capture/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-16T12:58:20Z","updated_at":"2015-08-25T11:30:27Z","closed_at":null,"body":"I have imported 0.3.11 library into Processing and entered the following code.\r\n```\r\nimport com.github.sarxos.webcam.Webcam;\r\nimport java.util.List;\r\n\r\nvoid setup(){\r\n  \r\n   // I list all the cams to check the camera is seen and it is\r\n    for (Webcam webcam : Webcam.getWebcams()) { println(webcam.getName()); }\r\n \r\n   // I try the camera name I know and love but it is not found\r\n    Webcam webcam = Webcam.getWebcamByName(\"MHS-FS2\");\r\n    if (webcam != null) {\r\n      System.out.println(\"Webcam: \" + webcam.getName());\r\n    } else {\r\n      System.out.println(\"No webcam detected\");\r\n    }\r\n    \r\n    // I still see the camera\r\n    List<Webcam> cams = Webcam.getWebcams();\r\n    System.out.println(cams.get(1).getName());\r\n    \r\n  // I get the code to build the string and voila!  I need to know where the camera is in the list\r\n    webcam = Webcam.getWebcamByName(cams.get(1).getName());\r\n    if (webcam != null) {\r\n      System.out.println(\"Webcam: \" + webcam.getName());\r\n    } else {\r\n      System.out.println(\"No webcam detected\");\r\n    }\r\n    \r\n  noLoop();\r\n}\r\n\r\nvoid draw() {\r\n}\r\n```\r\n\r\nThe loop through cams returns my camera in the list.  \r\n\r\nHowever, the call getWebcamByName(\"MHS-FS2\") fails with a null.  \r\n\r\nLifting the element (1) from the list of cams returns the \"MHS-FS2 1\".  \r\n\r\nSo the code concatenates the list position of the camera to the camera name which is not intuitive .  The result is a tuple and likely akin to a dictionary or map where I expect to either to recover either the key or the val etc.   \r\n\r\nIs this something your code does or is it the OS?\r\n\r\nIf I attach multiple cameras, in different orders, I might expect that they appear in different positions in the list each time (dependant on how they are handled by OS of course).  Makes it hard to know in the code ahead of time.\r\n\r\nI do have two bloggies so I will be curious how I will need to juggle between the two (in that case I would still have to associate a list index with one or the other bloggie ... tricky, something for me to fiddle with).\r\n\r\nOtherwise, workable."},"comment":{"url":"https://api.github.com/repos/sarxos/webcam-capture/issues/comments/134559614","html_url":"https://github.com/sarxos/webcam-capture/issues/383#issuecomment-134559614","issue_url":"https://api.github.com/repos/sarxos/webcam-capture/issues/383","id":134559614,"user":{"login":"Bazmundi","id":1772587,"avatar_url":"https://avatars.githubusercontent.com/u/1772587?v=3","gravatar_id":"","url":"https://api.github.com/users/Bazmundi","html_url":"https://github.com/Bazmundi","followers_url":"https://api.github.com/users/Bazmundi/followers","following_url":"https://api.github.com/users/Bazmundi/following{/other_user}","gists_url":"https://api.github.com/users/Bazmundi/gists{/gist_id}","starred_url":"https://api.github.com/users/Bazmundi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bazmundi/subscriptions","organizations_url":"https://api.github.com/users/Bazmundi/orgs","repos_url":"https://api.github.com/users/Bazmundi/repos","events_url":"https://api.github.com/users/Bazmundi/events{/privacy}","received_events_url":"https://api.github.com/users/Bazmundi/received_events","type":"User","site_admin":false},"created_at":"2015-08-25T11:30:27Z","updated_at":"2015-08-25T11:30:27Z","body":"Yep.  Gotcha.  I do note that I did get stung, having downgraded from Windoze 7 to Windoze 10, as my cameras are listed in reverse order between the two versions of the OS.  The real quirk being that the Processing Video library returns entirely a different name for the camera as it appears to print a name for each resolution of the camera and no index.  No matter, I am using your library and thankfully yours actually works ;) \r\n\r\nWell done!"}}