diff --git a/src/components/itemcontextmenu.js b/src/components/itemcontextmenu.js index 5f649a2b02..dbc73f2da4 100644 --- a/src/components/itemcontextmenu.js +++ b/src/components/itemcontextmenu.js @@ -134,6 +134,11 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter', name: globalize.translate('Download'), id: 'download' }); + + commands.push({ + name: globalize.translate('CopyStreamURL'), + id: 'copy-stream' + }); } var canEdit = itemHelper.canEdit(user, item); @@ -305,6 +310,22 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter', getResolveFunction(getResolveFunction(resolve, id), id)(); }); break; + case 'copy-stream': + var downloadHref = apiClient.getItemDownloadUrl(itemId); + var textArea = document.createElement("textarea"); + textArea.value = downloadHref; + document.body.appendChild(textArea); + textArea.focus(); + textArea.select(); + try { + document.execCommand('copy'); + } catch (err) { + + } + + document.body.removeChild(textArea); + getResolveFunction(resolve, id)(); + break; case 'editsubtitles': require(['subtitleEditor'], function (subtitleEditor) { subtitleEditor.show(itemId, serverId).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id)); diff --git a/src/strings/en-gb.json b/src/strings/en-gb.json index 5873d8ae70..96d5f1851c 100644 --- a/src/strings/en-gb.json +++ b/src/strings/en-gb.json @@ -452,5 +452,6 @@ "HeaderPassword": "Password", "HeaderPasswordReset": "Password Reset", "HeaderPaths": "Paths", - "HeaderPendingInvitations": "Pending Invitations" + "HeaderPendingInvitations": "Pending Invitations", + "CopyStreamURL": "Copy Stream URL" } diff --git a/src/strings/en-us.json b/src/strings/en-us.json index ae8226b4fd..b701cd1f5f 100644 --- a/src/strings/en-us.json +++ b/src/strings/en-us.json @@ -160,6 +160,7 @@ "Connect": "Connect", "ContinueWatching": "Continue watching", "Continuing": "Continuing", + "CopyStreamURL": "Copy Stream URL", "CriticRating": "Critic rating", "CustomDlnaProfilesHelp": "Create a custom profile to target a new device or override a system profile.", "DateAdded": "Date added",