Skip to content

Commit cc72962

Browse files
committed
2023.09.02: Enable CORS and timestamp in HLS. v5.8.30
1 parent a3eee03 commit cc72962

File tree

6 files changed

+7
-11
lines changed

6 files changed

+7
-11
lines changed

platform/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ func initPlatform(ctx context.Context) error {
357357
}
358358

359359
// Run only once for a special version.
360-
bootRelease := "v28"
360+
bootRelease := "v202328"
361361
if firstRun, err := rdb.HGet(ctx, SRS_FIRST_BOOT, bootRelease).Result(); err != nil && err != redis.Nil {
362362
return errors.Wrapf(err, "hget %v %v", SRS_FIRST_BOOT, bootRelease)
363363
} else if firstRun == "" {

platform/service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ func handleHTTPService(ctx context.Context, handler *http.ServeMux) error {
300300
}
301301
if strings.HasSuffix(r.URL.Path, ".ts") {
302302
httpAllowCORS(w, r)
303-
w.Header().Set("Cache-Control", fmt.Sprintf("public, max-age=%v", 300))
303+
w.Header().Set("Cache-Control", fmt.Sprintf("public, max-age=%v", 600))
304304
hlsFileServer.ServeHTTP(w, r)
305305
return
306306
}

platform/utils.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ func srsGenerateConfig(ctx context.Context) error {
446446
" hls_window 60;",
447447
" hls_path ./objs/nginx/html;",
448448
" hls_m3u8_file [app]/[stream].m3u8;",
449-
" hls_ts_file [app]/[stream]-[seq].ts;",
449+
" hls_ts_file [app]/[stream]-[seq]-[timestamp].ts;",
450450
" hls_wait_keyframe on;",
451451
" hls_dispose 10;",
452452
}
@@ -1248,12 +1248,8 @@ func Authenticate(ctx context.Context, apiSecret, token string, header http.Head
12481248
}
12491249

12501250
// httpAllowCORS allow CORS for HTTP request.
1251+
// Note that we always enable CROS because we enable HTTP cache.
12511252
func httpAllowCORS(w http.ResponseWriter, r *http.Request) {
1252-
// Ignore if no CORS required.
1253-
if r.Header.Get("Origin") == "" {
1254-
return
1255-
}
1256-
12571253
// SRS does not need cookie or credentials, so we disable CORS credentials, and use * for CORS origin,
12581254
// headers, expose headers and methods.
12591255
w.Header().Set("Access-Control-Allow-Origin", "*")

platform/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
package main
77

88
// The version for platform.
9-
const version = "v5.8.28"
9+
const version = "v5.8.30"

scripts/setup-aapanel/info.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"title": "SRS Stack",
33
"name": "srs_stack",
44
"ps": "SRS is a simple, high efficiency and realtime video server, supports RTMP, WebRTC, HLS, HTTP-FLV, and SRT.",
5-
"versions": "5.8.28",
5+
"versions": "5.8.30",
66
"checks": "/www/server/panel/plugin/srs_stack",
77
"author": "Winlin",
88
"home": "https://github.com/ossrs/srs-stack"

scripts/setup-bt/info.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"title": "SRS音视频服务器",
33
"name": "srs_stack",
44
"ps": "直播和WebRTC音视频能力,支持RTMP、WebRTC、HLS、HTTP-FLV、SRT、MPEG-DASH和GB28181等常用协议",
5-
"versions": "5.8.28",
5+
"versions": "5.8.30",
66
"checks": "/www/server/panel/plugin/srs_stack",
77
"author": "Winlin",
88
"home": "https://github.com/ossrs/srs-stack"

0 commit comments

Comments
 (0)