適用於 Node.js 的 Azure 媒體服務模組Azure Media Services modules for Node.js

Azure 媒體服務是一個可延伸的雲端型平台,供開發人員建置可擴充的媒體管理和傳遞應用程式。Azure Media Services is an extensible cloud-based platform that enables developers to build scalable media management and delivery applications. 媒體服務是以 REST API 為基礎,可讓您安全地上傳、儲存、編碼和封裝視訊或音訊內容,以用於隨選和即時資料流傳遞給各種用戶端 (例如電視、電腦和行動裝置)。Media Services is based on REST APIs that enable you to securely upload, store, encode, and package video or audio content for both on-demand and live streaming delivery to various clients (for example, TV, PC, and mobile devices).

使用 Azure 媒體服務,您可以:With Azure Media Services, you can:

  • 建置完全採用媒體服務的端對端工作流程。Build end-to-end workflows using entirely Media Services.
  • 在工作流程的某些部分使用第三方元件。Use third-party components for some parts of your workflow. 例如,使用第三方編碼器來進行編碼;For example, encode using a third-party encoder. 然後使用媒體服務上傳、保護、封裝、傳遞。Then, upload, protect, package, deliver using Media Services.
  • 即時串流您的內容或傳遞隨選內容。Stream your content live or deliver content on-demand. 本主題也會連結到其他相關主題。The topic also links to other relevant topics.

管理套件Management Package

安裝 npm 模組Install the npm module

安裝 Azure 媒體服務 npm 模組Install the Azure media services npm module

npm install azure-arm-mediaservices

範例Example

此範例會列出資源群組的所有媒體服務。This example lists all media services for a resource group.

const msRestAzure = require('ms-rest-azure');
const mediaServicesManagement = require('azure-arm-mediaservices');

const subscriptionId = 'your-subscription-id';
const resourceGroup = 'your-resource-group';
let mediaServicesClient;

msRestAzure.interactiveLogin().then(credentials => {
  mediaServicesClient = new mediaServicesManagement(credentials, subscriptionId);
  mediaServicesClient.mediaServiceOperations
    .listByResourceGroup(resourceGroup)
    .then(mediaServices => console.log('Retrieved media services: ', mediaServices));
});

範例Samples

深入探索可在應用程式中使用的 Node.js 程式碼範例Explore more sample Node.js code you can use in your apps.