detect unsupported (non-youtube) HLS

This commit is contained in:
F. Duncanh
2025-02-02 17:35:05 -05:00
parent e60bf9caee
commit 14e6ba5543
7 changed files with 56 additions and 27 deletions

View File

@@ -9,16 +9,17 @@ class="uri">https://github.com/FDH2/UxPlay</a> (where ALL user issues
should be posted, and latest versions can be found).</strong></h3>
<ul>
<li><em><strong>NEW in v1.71</strong>: Support for (YouTube) HLS (HTTP
Live Streaming) video with the new “-hls” option.</em> Click on the
airplay icon in the YouTube app to stream video. (You may need to wait
until advertisements have finished or been skipped before clicking the
YouTube airplay icon.) <strong>Please report any issues with this new
feature of UxPlay</strong>. <em>The default video player for HLS is
GStreamer playbin v3: use “-hls 2” to revert to playbin v2 if some
videos fail to play</em>.</li>
Live Streaming) video with the new “-hls” option.</em> <strong>Only
streaming from the YouTube iOS app is currently supported</strong>:
(streaming using the AirPlay icon in a browser window is
<strong>not</strong> yet supported).Click on the airplay icon in the
YouTube app to stream video. (You may need to wait until advertisements
have finished or been skipped before clicking the YouTube airplay icon.)
<strong>Please report any issues with this new feature of
UxPlay</strong>. <em>The default video player for HLS is GStreamer
playbin v3: use “-hls 2” to revert to playbin v2 if some videos fail to
play</em>.</li>
</ul>
<p><strong><em>NEWS</em></strong>: macOS Sequoia 15.2 has an AirPlay
bug: update to macOS 15.3 for mirroring screen with UxPlay.</p>
<h2 id="highlights">Highlights:</h2>
<ul>
<li>GPLv3, open source.</li>

View File

@@ -3,7 +3,9 @@
### **Now developed at the GitHub site <https://github.com/FDH2/UxPlay> (where ALL user issues should be posted, and latest versions can be found).**
- ***NEW in v1.71**: Support for (YouTube) HLS (HTTP Live Streaming)
video with the new "-hls" option.* Click on the airplay icon in the
video with the new "-hls" option.* **Only streaming from the YouTube iOS app
is currently supported**: (streaming using the AirPlay icon in a browser window
is **not** yet supported).Click on the airplay icon in the
YouTube app to stream video. (You may need to wait until
advertisements have finished or been skipped before clicking the
YouTube airplay icon.) **Please report any issues with this new
@@ -11,9 +13,6 @@
GStreamer playbin v3: use "-hls 2" to revert to playbin v2 if
some videos fail to play_.
***NEWS***: macOS Sequoia 15.2 has an AirPlay bug: update to macOS 15.3
for mirroring screen with UxPlay.
## Highlights:
- GPLv3, open source.

View File

@@ -3,17 +3,16 @@
### **Now developed at the GitHub site <https://github.com/FDH2/UxPlay> (where ALL user issues should be posted, and latest versions can be found).**
- ***NEW in v1.71**: Support for (YouTube) HLS (HTTP Live Streaming)
video with the new "-hls" option.* Click on the airplay icon in the
YouTube app to stream video. (You may need to wait until
video with the new "-hls" option.* **Only streaming from the YouTube
iOS app is currently supported**: (streaming using the AirPlay icon
in a browser window is **not** yet supported).Click on the airplay
icon in the YouTube app to stream video. (You may need to wait until
advertisements have finished or been skipped before clicking the
YouTube airplay icon.) **Please report any issues with this new
feature of UxPlay**. *The default video player for HLS is GStreamer
playbin v3: use "-hls 2" to revert to playbin v2 if some videos fail
to play*.
***NEWS***: macOS Sequoia 15.2 has an AirPlay bug: update to macOS 15.3
for mirroring screen with UxPlay.
## Highlights:
- GPLv3, open source.

View File

@@ -836,12 +836,14 @@ http_handler_play(raop_conn_t *conn, http_request_t *request, http_response_t *r
char **response_data, int *response_datalen) {
char* playback_location = NULL;
char* client_proc_name = NULL;
plist_t req_root_node = NULL;
float start_position_seconds = 0.0f;
bool data_is_binary_plist = false;
bool data_is_text = false;
bool data_is_octet = false;
char supported_hls_proc_names[] = "YouTube;";
logger_log(conn->raop->logger, LOGGER_DEBUG, "http_handler_play");
const char* session_id = http_request_get_header(request, "X-Apple-Session-ID");
@@ -902,6 +904,17 @@ http_handler_play(raop_conn_t *conn, http_request_t *request, http_response_t *r
plist_get_string_val(req_content_location_node, &playback_location);
}
plist_t req_client_proc_name_node = plist_dict_get_item(req_root_node, "clientProcName");
if (!req_client_proc_name_node) {
goto play_error;
} else {
plist_get_string_val(req_client_proc_name_node, &client_proc_name);
if (!strstr(supported_hls_proc_names, client_proc_name)){
logger_log(conn->raop->logger, LOGGER_WARNING, "Unsupported HLS streaming format: clientProcName %s not found in supported list: %s",
client_proc_name, supported_hls_proc_names);
}
}
plist_t req_start_position_seconds_node = plist_dict_get_item(req_root_node, "Start-Position-Seconds");
if (!req_start_position_seconds_node) {
logger_log(conn->raop->logger, LOGGER_INFO, "No Start-Position-Seconds in Play request");
@@ -914,6 +927,10 @@ http_handler_play(raop_conn_t *conn, http_request_t *request, http_response_t *r
}
char *ptr = strstr(playback_location, "/master.m3u8");
if (!ptr) {
logger_log(conn->raop->logger, LOGGER_ERR, "Content-Location has unsupported form:\n%s\n", playback_location);
goto play_error;
}
int prefix_len = (int) (ptr - playback_location);
set_uri_prefix(conn->raop->airplay_video, playback_location, prefix_len);
set_next_media_uri_id(conn->raop->airplay_video, 0);
@@ -932,8 +949,10 @@ http_handler_play(raop_conn_t *conn, http_request_t *request, http_response_t *r
if (req_root_node) {
plist_free(req_root_node);
}
logger_log(conn->raop->logger, LOGGER_ERR, "Could not find valid Plist Data for /play, Unhandled");
logger_log(conn->raop->logger, LOGGER_ERR, "Could not find valid Plist Data for POST/play request, Unhandled");
http_response_init(response, "HTTP/1.1", 400, "Bad Request");
http_response_set_disconnect(response, 1);
conn->raop->callbacks.conn_reset(conn->raop->callbacks.cls, 2);
}
/* the HLS handler handles http requests GET /[uri] on the HLS channel from the media player to the Server, asking for

View File

@@ -68,11 +68,13 @@ struct raop_callbacks_s {
void (*video_pause)(void *cls);
void (*video_resume)(void *cls);
void (*conn_feedback) (void *cls);
/* Optional but recommended callback functions */
void (*conn_reset) (void *cls, int reason);
void (*video_reset) (void *cls);
/* Optional but recommended callback functions (probably not optional, check this)*/
void (*conn_init)(void *cls);
void (*conn_destroy)(void *cls);
void (*conn_reset) (void *cls);
void (*conn_teardown)(void *cls, bool *teardown_96, bool *teardown_110 );
void (*audio_flush)(void *cls);
void (*video_flush)(void *cls);
@@ -88,7 +90,6 @@ struct raop_callbacks_s {
void (*register_client) (void *cls, const char *device_id, const char *pk_str, const char *name);
bool (*check_register) (void *cls, const char *pk_str);
void (*export_dacp) (void *cls, const char *active_remote, const char *dacp_id);
void (*video_reset) (void *cls);
void (*video_set_codec)(void *cls, video_codec_t codec);
/* for HLS video player controls */
void (*on_video_play) (void *cls, const char *location, const float start_position);

View File

@@ -811,7 +811,7 @@ raop_rtp_mirror_thread(void *arg)
logger_log(raop_rtp_mirror->logger, LOGGER_DEBUG, "raop_rtp_mirror exiting TCP thread");
if (conn_reset&& raop_rtp_mirror->callbacks.conn_reset) {
raop_rtp_mirror->callbacks.conn_reset(raop_rtp_mirror->callbacks.cls);
raop_rtp_mirror->callbacks.conn_reset(raop_rtp_mirror->callbacks.cls, 1);
}
if (unsupported_codec) {

View File

@@ -1630,8 +1630,18 @@ extern "C" void conn_feedback (void *cls) {
missed_feedback = 0;
}
extern "C" void conn_reset (void *cls) {
LOGI("***ERROR lost connection with client (network problem?)");
extern "C" void conn_reset (void *cls, int reason) {
switch (reason) {
case 1:
LOGI("*** ERROR lost connection with client (network problem?)");
break;
case 2:
LOGI("*** ERROR Unsupported HLS streaming source: (exit attempt to stream)");
break;
default:
break;
}
if (!nofreeze) {
close_window = false; /* leave "frozen" window open */
}