OSS supports three video upload methods — the OSS console, OSS SDKs, and Real-Time Messaging Protocol (RTMP) stream ingest — and the playback approach depends on which method you used. This guide covers how to get a playable URL for each method and how to fix the most common playback issues.
Choose your playback path
| Upload method | Playback scenario | What to do |
|---|---|---|
| OSS console or SDK | On-demand | Get the object URL and open it in a browser or player — details below |
| RTMP stream ingest | Live (during ingest) | Use HTTP Live Streaming (HLS) — details below |
| RTMP stream ingest | On-demand (after ingest) | Call PostVodPlaylist to build an M3U8 playlist, then use the object URL — details below |
By default, the OSS domain forces a file download instead of a browser preview. To enable in-browser playback, map a custom domain to your bucket. See Enable in-browser preview with a custom domain.
Play videos uploaded via the OSS console or SDKs
OSS serves objects through public API operations. To play a video uploaded via the OSS console or an OSS SDK:
Get the URL of the video object. See Share objects with signed URLs.
Open the URL in a browser or media player.
The object URL has this structure:
https://<bucket-name>.<endpoint>/<object-key>For example: https://examplebucket.oss-ap-southeast-1.aliyuncs.com/videos/sample.mp4
If the URL triggers a download instead of playing the video, you are accessing the object through the default OSS domain. Map a custom domain to your bucket to enable preview. See Enable in-browser preview with a custom domain.
Play videos uploaded via RTMP stream ingest
Live streaming
During stream ingest, use HLS to play the video in real time:
| Platform | How to play |
|---|---|
| Android and iOS | Enter the LiveChannel streaming URL in the browser. Use ListLiveChannel to get the URL. |
| macOS | Use Safari. |
| Other desktop platforms | Use VLC media player. |
On-demand playback
After stream ingest completes:
Call PostVodPlaylist to assemble an M3U8 playlist object from the ingested transport stream (TS) segments.
Use the resulting M3U8 object URL to play the video.
In on-demand playback scenarios, you can set a larger group of pictures (GOP) size to reduce the number of TS objects and lower the bitrate.
Enable in-browser preview with a custom domain
The default OSS domain adds the following headers when either of these conditions is met:
OSS was activated after 00:00 on October 9, 2022 and you access the object using a default OSS domain.
Transfer acceleration was enabled for the bucket after 11:07 on November 17, 2020 and you access the object through the acceleration endpoint.
x-oss-force-download: true
Content-Disposition: attachmentThe Content-Disposition: attachment header forces a download instead of a preview. Mapping a custom domain to your bucket removes these headers and enables in-browser preview.
A custom domain also unlocks:
Hotlink protection: Restrict which sites can embed your videos by configuring a Referer allowlist. See Hotlink protection.
HTTPS: Serve videos over HTTPS by hosting an SSL certificate on the custom domain. See Host SSL certificates.
Separate download and preview URLs: Generate signed URLs with
Content-Disposition: attachment(download) orContent-Disposition: inline(preview) for the same object. See sign (generate signed object URLs).
To map a custom domain, see Map custom domain names.
Domain registration requirements:
Register a domain name with Alibaba Cloud Domains and create a CNAME record pointing to the bucket endpoint.
If the bucket is in the Chinese mainland, complete Internet Content Provider (ICP) filing for the domain using the Alibaba Cloud ICP filing service.
CNAME propagation typically takes several minutes to several hours, depending on TTL settings, DNS cache, and DNS propagation. If the bucket is inaccessible after mapping, verify your CNAME record configuration and wait for propagation to complete.
FAQ
Why does my browser fail to play the video?
Two common causes:
Unsupported format: Most browsers do not support M3U8 natively (Safari is an exception). Use ApsaraVideo Media Processing to transcode the video to a broadly supported format such as MP4.
Missing MIME type: OSS infers the Multipurpose Internet Mail Extensions (MIME) type from the file extension. If the object has no extension, the browser may not recognize it as a video. Set the
Content-Typeheader manually. See How do I configure the Content-Type header?.
How do I make a video permanently accessible via its URL?
Set the object's access control list (ACL) to public-read-write. See Object ACLs.
Setting the ACL to public-read-write allows all Internet users to access the object. This may result in unexpected access and unexpectedly high fees. Use this setting with caution.
How do I edit or transcode videos stored in OSS?
Use ApsaraVideo Media Processing to edit, watermark, and transcode videos. See What is ApsaraVideo Media Processing?.