Я установил расширение Chrome на Microsoft Edge (Chromium) для воспроизведения видео HLS. Я пробовал на Microsoft Edge (Chromium), и он работает нормально. URL HLS - http: //localhost/hls/taiguo/playlist.m3u8 и в браузере Microsoft Edge, и он отображает URL следующим образом: Расширение: //ekcifneimckhkjdfklkkpdlnckcjhmke/index.html#http: //localhost/hls/taiguo/playlist.m3u8. Приложение после [Начало работы с WebView2 (разработчик Предварительный просмотр)] (https://learn.microsoft.com/en-us/micro ... ingstarted) Пример кода:
`createcorewebview2environmentwithdetails (nullptr , nullptr, nullptr,
обратный вызов (
[hwnd] (hresult result, icorewebview2environment* env) -> hresult {< /p>
RETURN_IF_FAILED(result);
// Create a CoreWebView2Host and get the associated CoreWebView2 whose parent is the main window hWnd
env->CreateCoreWebView2Host(hWnd, Callback(
[hWnd](HRESULT result, ICoreWebView2Host* host) -> HRESULT {
if (host != nullptr) {
webviewHost = host;
webviewHost->get_CoreWebView2(&webviewWindow);
}
// Add a few settings for the webview
// this is a redundant demo step as they are the default settings values
ICoreWebView2Settings* Settings;
webviewWindow->get_Settings(&Settings);
Settings->put_IsScriptEnabled(TRUE);
Settings->put_AreDefaultScriptDialogsEnabled(TRUE);
Settings->put_IsWebMessageEnabled(TRUE);
// Resize WebView to fit the bounds of the parent window
RECT bounds;
GetClientRect(hWnd, &bounds);
webviewHost->put_Bounds(bounds);
// Schedule an async task to navigate to Bing
webviewWindow->Navigate(L"http://localhost/hls/taiguo/playlist.m3u8");`
< /code>
Если я запускаю приведенный выше код, приложение просто загрузит файл playlist.m3u8 без воспроизведения видео. Если я изменю параметр URL WebViewWindow-> vesigate (...) на: < /p>
webviewWindow->Navigate(L"extension://ekcifneimckhkjdfklkkpdlnckcjhmke/index.html#http://localhost/hls/taiguo/playlist.m3u8");
< /code>
Затем я получаю сообщение об ошибке, как показано ниже:
ecrem Можно сказать мне, как запустить расширение, используя API WebView2.
Подробнее здесь: https://stackoverflow.com/questions/612 ... n-webview2