{"action":"created","issue":{"url":"https://api.github.com/repos/ableplayer/ableplayer/issues/218","repository_url":"https://api.github.com/repos/ableplayer/ableplayer","labels_url":"https://api.github.com/repos/ableplayer/ableplayer/issues/218/labels{/name}","comments_url":"https://api.github.com/repos/ableplayer/ableplayer/issues/218/comments","events_url":"https://api.github.com/repos/ableplayer/ableplayer/issues/218/events","html_url":"https://github.com/ableplayer/ableplayer/pull/218","id":154899292,"number":218,"title":"Regarding Issue #205","user":{"login":"jessehall3","id":5696388,"avatar_url":"https://avatars.githubusercontent.com/u/5696388?v=3","gravatar_id":"","url":"https://api.github.com/users/jessehall3","html_url":"https://github.com/jessehall3","followers_url":"https://api.github.com/users/jessehall3/followers","following_url":"https://api.github.com/users/jessehall3/following{/other_user}","gists_url":"https://api.github.com/users/jessehall3/gists{/gist_id}","starred_url":"https://api.github.com/users/jessehall3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jessehall3/subscriptions","organizations_url":"https://api.github.com/users/jessehall3/orgs","repos_url":"https://api.github.com/users/jessehall3/repos","events_url":"https://api.github.com/users/jessehall3/events{/privacy}","received_events_url":"https://api.github.com/users/jessehall3/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-05-15T09:27:39Z","updated_at":"2016-05-16T21:39:12Z","closed_at":"2016-05-15T16:18:53Z","pull_request":{"url":"https://api.github.com/repos/ableplayer/ableplayer/pulls/218","html_url":"https://github.com/ableplayer/ableplayer/pull/218","diff_url":"https://github.com/ableplayer/ableplayer/pull/218.diff","patch_url":"https://github.com/ableplayer/ableplayer/pull/218.patch"},"body":"Regarding: https://github.com/ableplayer/ableplayer/issues/205\r\n\r\nHey @terrill ,\r\n\r\nI redid everything on a fresh pull because I still have two left feet when it comes to git and I couldn't get rid of all the cached files that I didn't want committed.\r\n\r\nAnyway, to reiterate, this is my work on supporting chapters in multiple languages. There seemed to be many ways to implement this, so I decided to have the the language of the chapters match the language of the captions, then the transcript, and then the player itself, depending on the on/off state of the captions and transcripts. The details are described below, as well as in the comments of the commit.\r\n\r\nI imagined you'd probably have a different idea for the implementation, but I thought the best start would be to put together something functioning, and then adjust as needed after getting feedback form you. For that reason, I didn't handle anything regarding \"populateChaptersDiv\".\r\n\r\nLikewise, I see that the transcript title (and maybe some other things I'm unaware of) could use some similar dynamic handling; again, I was going to wait for feedback.\r\n\r\n\r\nSome notes on testing: \r\n\r\nI added an extra chapters file to \"local_es.html\", and that's the only example where this feature can be tested. \r\n\r\nIf the captions are on, and in Spanish, the first chapter should read \"Introducción\". If you change the captions to English, the first chapter changes to \"Intro\". \r\n\r\nTurn the captions off, and the chapters will go back to Spanish, as this is the language of the player.\r\n\r\nTurn the transcripts on, and the chapters should still be in Spanish, because the transcript's default language will be Spanish.\r\n\r\nChange the transcript's language to English (with the captions still off), the chapters should go to English as well. I found that with the new draggable transcript field I could not change the value of the transcript language with my mouse -- the only way I was able to do this was to tab to the field and use the up and down arrow keys.\r\n\r\nFrom there you can test all the possible combinations of captions and transcript languages and on/off states to see if it follows the desired pattern described in more detail below. The pattern can obviously be changed as desired.\r\n\r\nAnd that's all I have to say. If have the time to look at this, please let me know what you think. I'd be happy to continue working on this.\r\n\r\nThanks,\r\n\r\nJesse\r\n\r\n-------------------------------------------------------\r\n\r\nFrom the commit:\r\n\r\nI used \"local_es.html\" for my testing.\r\n\r\nI added a second chapter track file called \"wwa_chapters_es.vtt\" and included the source in video element in \"local_es.html\". Also, both chapter tracks now have a specified \"scrlang\". The only difference between the English chapters and the Spanish ones is that \"Intro\" becomes \"Introducción\" in Spanish. This is not to say that \"Intro\" would be an invalid abbreviation in Spanish, I just needed to make some distinction.\r\n\r\nThe chapter tracks are handled as follows:\r\n\r\n1. If the captions are on, the chapter track tries to match the language of the captions.\r\n2. If the captions are off, but the transcript is on, the chapter track tries to match the transcript.\r\n3. If both the captions and the transcript are off (not showing), then the chapter track tries to match the player.\r\n4. If no matches are made in any of the above situations, it defaults to the first chapter track available.\r\n\r\nThe code implementing that logic can be found in the \"updateChaptersLanguage\" function. (see chapters.js)\r\n\r\nThe rest of the code:\r\n\r\n1. I created  \"updateChaptersLanguage\" to implement the logic as I described above. (see chapters.js)\r\n\r\n2. In \"setupPopups\" I added \"updateChaptersLanguage\" under the condition 'else if (popup == 'chapters') '.That way it always tries to match the appropriate language before changing the text in the chapter pop-ups. (see buildplayer.js)\r\n\r\n3. Because that is all is inside \"setupPopups\" it will be called by \"recreatePlayer\" when the player initially builds. (see ableplayer-base.js)\r\n\r\n4. I added \"setupPopups('chapters')\" into \"refreshControls\". This makes the chapter track respond to the captions because \"refreshControls()\" is called in both \"getCaptionClickFunction\" and \"getCaptionOffFunction\". (see control.js)\r\n\r\n5. To respond to changes in the language of the transcript, I added \"thisObj.setupPopups ('chapters');\" to the callback in \"$transcriptLanguageSelect.change()\". (see transcript.js)\r\n\r\n6. To respond to the trascripts being toggled on and off, I added \"this.setupPopups('chapters');\" to the bottom of \"handleTranscriptToggle\". (see control.js)"},"comment":{"url":"https://api.github.com/repos/ableplayer/ableplayer/issues/comments/219556452","html_url":"https://github.com/ableplayer/ableplayer/pull/218#issuecomment-219556452","issue_url":"https://api.github.com/repos/ableplayer/ableplayer/issues/218","id":219556452,"user":{"login":"terrill","id":912874,"avatar_url":"https://avatars.githubusercontent.com/u/912874?v=3","gravatar_id":"","url":"https://api.github.com/users/terrill","html_url":"https://github.com/terrill","followers_url":"https://api.github.com/users/terrill/followers","following_url":"https://api.github.com/users/terrill/following{/other_user}","gists_url":"https://api.github.com/users/terrill/gists{/gist_id}","starred_url":"https://api.github.com/users/terrill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terrill/subscriptions","organizations_url":"https://api.github.com/users/terrill/orgs","repos_url":"https://api.github.com/users/terrill/repos","events_url":"https://api.github.com/users/terrill/events{/privacy}","received_events_url":"https://api.github.com/users/terrill/received_events","type":"User","site_admin":false},"created_at":"2016-05-16T21:39:12Z","updated_at":"2016-05-16T21:39:12Z","body":"On closer inspection, there actually were a few problems that required some additional attention. Here are some key demo files for testing related to chapter and/or transcript support in multiple languages: \r\n\r\n- **video5.html**: Has chapters in a pop-up menu with accompanying transcript, defaults to English \r\n- **local_es.html**: Same as above, defaults to Spanish \r\n- **video12.html**: Has chapters in an external container (not a popup), plus captions/transcript in two languages  \r\n- **youtube.html**: Same as above, but has a lot more content, plus captions/transcript in 3 languages. \r\n\r\nIn wrestling with the bugs that had crept into the above demo scenarios, I ended up creating a new function syncTrackLanguages() in control.js that serves as the hub for keeping all time-synced assets synchronized.    \r\n\r\nNote that when the user changes the caption language, that changes the language everywhere (transcript, description, chapters, chapters popup menu, and metadata). However, when they change the transcript language, that *only* changes the transcript language. That was a group decision from a while ago, in order to make it possible for users to have captions in one language and a transcript in another (a useful feature if they're studying a foreign language).  \r\n\r\nAll of these changes are reflected in d2ee4c065aa91962703cc88bd4f4093e76f6910c "}}