{"id":8395,"date":"2021-11-15T11:34:26","date_gmt":"2021-11-15T16:34:26","guid":{"rendered":"https:\/\/www.rushworth.us\/lisa\/?p=8395"},"modified":"2021-11-15T11:45:52","modified_gmt":"2021-11-15T16:45:52","slug":"exporting-microsoft-stream-transcripts-with-timecode-urls","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=8395","title":{"rendered":"Exporting Microsoft Stream Transcripts with Timecode URLs"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I&#8217;d created a couple of quick code snippets to export Microsoft Stream transcripts &amp; someone asked if you could include a way for users to click on a hyperlink and pop into the video at the right spot for the line in the transcript they clicked. Seemed like a good idea &#8212; I&#8217;ve searched though my meeting transcript &amp; now I want to see\/hear that important part in the original video. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The method I&#8217;m using to grab the transcript text actually grabs a LOT of information that&#8217;s thrown into an object being called &#8216;t&#8221;:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/11\/exportingStreamTranscriptTObject.png\"><img loading=\"lazy\" decoding=\"async\" width=\"795\" height=\"211\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/11\/exportingStreamTranscriptTObject.png\" alt=\"\" class=\"wp-image-8396\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/11\/exportingStreamTranscriptTObject.png 795w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/11\/exportingStreamTranscriptTObject-300x80.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/11\/exportingStreamTranscriptTObject-768x204.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/11\/exportingStreamTranscriptTObject-750x199.png 750w\" sizes=\"auto, (max-width: 795px) 100vw, 795px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">I was only using t.eventData.text to build my transcript. What do you need in order to create a jump-to-this-timecode URL for a Stream video? I had no idea! Luckily, MS supplied an easy answer &#8212; if you share a video, one of the options is to start the video at a specific time. If you pass in &#8220;st&#8221; (which I assume stands for &#8216;start time&#8217;) and the number of seconds ( (17 * 60) + 39 = 1059, so the 17:39 from my video matches up with 1059 seconds in the st)<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/11\/exportingStreamTimecodeURL.png\"><img loading=\"lazy\" decoding=\"async\" width=\"797\" height=\"301\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/11\/exportingStreamTimecodeURL.png\" alt=\"\" class=\"wp-image-8397\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/11\/exportingStreamTimecodeURL.png 797w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/11\/exportingStreamTimecodeURL-300x113.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/11\/exportingStreamTimecodeURL-768x290.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/11\/exportingStreamTimecodeURL-750x283.png 750w\" sizes=\"auto, (max-width: 797px) 100vw, 797px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">We still need the unique ID assigned to the video, but &#8230; I&#8217;m exporting the transcript from MS&#8217;s Stream site, which includes the ID in the URL. So I&#8217;m able to use window.location.href to get the URL, then strip everything past the ? &#8230; now I&#8217;ve got a way to create timecoded links to video content. I just need to glom that into the code I am using to export the transcript. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Question is &#8230; how to display it to the user? Clicking on a link for 1059 seconds doesn&#8217;t really mean anything. If I were doing this at work, I might pass the number of seconds through a &#8220;pretty time&#8221; function to convert that number of seconds back into hour:minute:second format so the user clicks on 17:39 &#8230; but, as a quick example, this builds hyperlinks with the integer number of seconds as text:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nvar strURL = window.location.href;\nstrURLBase = strURL.substring(0, strURL.indexOf(&#039;?&#039;));\n\nvar arrayTranscriptionLines = window.angular.element(window.document.querySelectorAll(&#039;.transcript-list&#039;)).scope().$ctrl.transcriptLines.map((t) =&gt; { \n\tvar strTimecodeURL = &#039;&lt;a href=&quot;&#039; + strURLBase + &#039;?st=&#039; + t.startSeconds + &#039;&quot;&gt;&#039; + t.startSeconds + &#039;&lt;\/a&gt;&#039;\n\treturn strTimecodeURL + &quot;&amp;nbps;&amp;nbps;&amp;nbps;&amp;nbps;&quot; + t.eventData.text;\n});\nconsole.log(arrayTranscriptionLines);\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">I might also just link the <em>transcript text<\/em> to the appropriate URL. Then clicking on the text &#8220;I want you to remember this&#8221; would jump you to the right place in the video where that line occurs:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nvar strURL = window.location.href;\nstrURLBase = strURL.substring(0, strURL.indexOf(&#039;?&#039;));\n\nvar arrayTranscriptionLines = window.angular.element(window.document.querySelectorAll(&#039;.transcript-list&#039;)).scope().$ctrl.transcriptLines.map((t) =&gt; { \n\tvar strResult = &#039;&lt;a href=&quot;&#039; + strURLBase + &#039;?st=&#039; + t.startSeconds + &#039;&quot;&gt;&#039; + t.eventData.text + &#039;&lt;\/a&gt;&#039;\n\treturn strResult;\n});\nconsole.log(arrayTranscriptionLines);\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">And we&#8217;ve got hyperlinked text that jumps to the right spot:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/11\/exportingStreamResults.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"222\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/11\/exportingStreamResults-1024x222.png\" alt=\"\" class=\"wp-image-8398\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/11\/exportingStreamResults-1024x222.png 1024w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/11\/exportingStreamResults-300x65.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/11\/exportingStreamResults-768x167.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/11\/exportingStreamResults-750x163.png 750w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/11\/exportingStreamResults.png 1115w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;d created a couple of quick code snippets to export Microsoft Stream transcripts &amp; someone asked if you could include a way for users to click on a hyperlink and pop into the video at the right spot for the line in the transcript they clicked. Seemed like a good idea &#8212; I&#8217;ve searched though &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[677],"tags":[45,856,729,713,265,1329],"class_list":["post-8395","post","type-post","status-publish","format-standard","hentry","category-office-365","tag-coding","tag-javascript","tag-microsoft-office-365","tag-microsoft-stream","tag-office-365","tag-web-coding"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/8395","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8395"}],"version-history":[{"count":2,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/8395\/revisions"}],"predecessor-version":[{"id":8403,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/8395\/revisions\/8403"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8395"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8395"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}