Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If static content returning is enabled, browser will display the HLS player page by URL https://host:8445/hls-player.html. If this feature is disabled, server will return 404 Not found error by such URL.

Preloader for HLS stream playback

When first HLS subscribes connects to a stream on WCS server, especilally to CDN stream, it may take a time to split a stream to HLS segmets and to form a playlist. As a result, Safari browser on iOS devices may not be able to play HLS stream on the first attempt. To successfully play HLS stream in this case, the HLS preloader was added since build 5.2.371. The default preloader looks like this:

Image Added

Preloader segments are placed to /usr/local/FlashphonerWebCallserver/hls/.preloader folder

Code Block
themeRDark
ls /usr/local/FlashphonerWebCallserver/hls/.preloader
-rw-r--r-- 1 root root 51888 Oct 13 04:47 index0.ts
-rw-r--r-- 1 root root 52828 Oct 13 04:47 index10.ts
-rw-r--r-- 1 root root 54332 Oct 13 04:47 index11.ts
-rw-r--r-- 1 root root 53392 Oct 13 04:47 index12.ts
-rw-r--r-- 1 root root 52828 Oct 13 04:47 index13.ts
-rw-r--r-- 1 root root 52828 Oct 13 04:47 index14.ts
-rw-r--r-- 1 root root 53956 Oct 13 04:47 index15.ts
-rw-r--r-- 1 root root 54144 Oct 13 04:47 index16.ts
-rw-r--r-- 1 root root 52828 Oct 13 04:47 index17.ts
-rw-r--r-- 1 root root 52640 Oct 13 04:47 index18.ts
-rw-r--r-- 1 root root 53580 Oct 13 04:47 index19.ts
-rw-r--r-- 1 root root 52828 Oct 13 04:47 index1.ts
-rw-r--r-- 1 root root 53580 Oct 13 04:47 index2.ts
-rw-r--r-- 1 root root 54520 Oct 13 04:47 index3.ts
-rw-r--r-- 1 root root 52452 Oct 13 04:47 index4.ts
-rw-r--r-- 1 root root 52640 Oct 13 04:47 index5.ts
-rw-r--r-- 1 root root 53204 Oct 13 04:47 index6.ts
-rw-r--r-- 1 root root 54708 Oct 13 04:47 index7.ts
-rw-r--r-- 1 root root 52828 Oct 13 04:47 index8.ts
-rw-r--r-- 1 root root 52828 Oct 13 04:47 index9.ts

The default preloader can be replaced to custom one. To do this:

1. Choose video clip (logo for example)

2. Encode video to H264, add audio track to the clip, set GOP and remove B-frames using ffmpeg

Code Block
languagebash
themeRDark
ffmpeg -i clip.mp4 -f lavfi -i anullsrc=channel_layout=mono:sample_rate=44100 -c:v h264 -g 30 -bf 0 -shortest preloader.mp4

3. Download and install HLS tools from Apple site

4. Prepare custom preloader HLS segments

Code Block
languagebash
themeRDark
mediafilesegmenter -t 1 -B index -start-segments-with-iframe preloader.mp4
tar -cvzf preloader.tar.gz index*.ts

5. On WCS server, save default preloader backup copy

Code Block
languagebash
themeRDark
cd /usr/local/FlashphonerWebCallserver/hls
tar -cvzf ~/preloader_backup.tar.gz .preloader

6. Unpack custom preloader from archive prepared on step 4

Code Block
languagebash
themeRDark
cd /usr/local/FlashphonerWebCallserver/hls/.preloader
rm -f index*.ts
tar -xvzf ~/preloader.tar.gz

Debug logs for HLS session

...