Add HLS.js support and enhance content streaming logic

- Integrated HLS.js version 1.6.15 into the project for improved video streaming capabilities.
- Updated the ContentsController to check for HLS manifest availability and fall back to presigned URLs for original files if not found.
- Enhanced the VideoPlayer component to handle loading and error states more effectively, improving user experience during streaming.
- Refactored content service methods to return detailed streaming information, including HLS and DASH manifest URLs.
This commit is contained in:
Dorian
2026-02-13 00:04:53 +00:00
parent 0da83f461c
commit 7e9a35a963
9 changed files with 706 additions and 262 deletions

View File

@@ -353,25 +353,51 @@ export class BTCPayService implements LightningService {
const bolt11 = await this.resolveLightningAddress(address, sats);
// Pay the BOLT11 via BTCPay's internal Lightning node
const payUrl = this.storeUrl('/lightning/BTC/invoices/pay');
Logger.log(
`Paying ${sats} sats to ${address} via ${payUrl}`,
'BTCPayService',
);
const { data } = await axios.post<BTCPayLightningPayResponse>(
this.storeUrl('/lightning/BTC/invoices/pay'),
payUrl,
{ BOLT11: bolt11 },
{ headers: this.headers },
);
if (data.result !== 'Ok') {
Logger.log(
`BTCPay pay response: ${JSON.stringify(data)}`,
'BTCPayService',
);
// BTCPay Greenfield API returns different shapes depending on version.
// Older versions return { result, errorDetail, paymentHash }.
// Newer versions may return the payment hash/preimage at top level
// or an empty 200 on success.
const result = data?.result;
const paymentHash =
data?.paymentHash ?? (data as any)?.payment_hash ?? 'btcpay-payment';
if (result && result !== 'Ok') {
throw new Error(
`Lightning payment failed: ${data.result}${data.errorDetail || 'unknown error'}`,
`Lightning payment failed: ${result}${data?.errorDetail || 'unknown error'}`,
);
}
return {
id: data.paymentHash || 'btcpay-payment',
id: paymentHash,
status: 'COMPLETED',
};
} catch (error) {
Logger.error('BTCPay sendPayment failed: ' + error.message, 'BTCPayService');
throw new Error(error.message);
const detail =
error.response?.data
? JSON.stringify(error.response.data)
: error.message;
Logger.error(
`BTCPay sendPayment failed: ${detail}`,
'BTCPayService',
);
throw new Error(detail);
}
}