Added webYouTubeVideoCreate and improved web docs.

This commit is contained in:
yellows8 2019-02-27 20:44:11 -05:00
parent 81ce04eb7b
commit 526441a547
2 changed files with 25 additions and 1 deletions

View File

@ -141,7 +141,7 @@ void webWifiCreate(WebWifiConfig* config, const char* conntest_url, const char*
Result webWifiShow(WebWifiConfig* config, WebWifiReturnValue *out);
/**
* @brief Creates the config for WebApplet. This applet uses an URL whitelist loaded from the user-process host title.
* @brief Creates the config for WebApplet. This applet uses an URL whitelist loaded from the user-process host title, when running under an Application. Content mounting *must* be successful otherwise the applet will throw a fatalerr.
* @note Sets WebArgType_UnknownD, and WebArgType_Unknown12 on pre-3.0.0, to value 1.
* @param config WebCommonConfig object.
* @param url Initial URL navigated to by the applet.
@ -157,6 +157,15 @@ Result webPageCreate(WebCommonConfig* config, const char* url);
*/
Result webNewsCreate(WebCommonConfig* config, const char* url);
/**
* @brief Creates the config for WebApplet. This is based on \ref webPageCreate, for YouTubeVideo. Hence other functions referencing \ref webPageCreate also apply to this. This uses a whitelist which essentially only allows youtube embed/ URLs (without mounting content from the host title).
* @note This is only available on [5.0.0+].
* @note Sets WebArgType_UnknownD to value 1, and sets WebArgType_YouTubeVideoFlag to true. Also uses \ref webConfigSetBootAsMediaPlayer with flag=true.
* @param config WebCommonConfig object.
* @param url Initial URL navigated to by the applet.
*/
Result webYouTubeVideoCreate(WebCommonConfig* config, const char* url);
/**
* @brief Sets the CallbackUrl.
* @note Only available with config created by \ref webPageCreate or with Share-applet.

View File

@ -194,6 +194,21 @@ Result webNewsCreate(WebCommonConfig* config, const char* url) {
return rc;
}
Result webYouTubeVideoCreate(WebCommonConfig* config, const char* url) {
Result rc=0;
if (hosversionBefore(5,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
_webArgInitialize(config, AppletId_web, WebShimKind_Web);
rc = _webConfigSetU8(config, WebArgType_UnknownD, 1);
if (R_SUCCEEDED(rc)) rc = _webConfigSetFlag(config, WebArgType_YouTubeVideoFlag, true);
if (R_SUCCEEDED(rc)) rc = webConfigSetBootAsMediaPlayer(config, true);
if (R_SUCCEEDED(rc)) rc = _webConfigSetUrl(config, url);
return rc;
}
Result webConfigSetCallbackUrl(WebCommonConfig* config, const char* url) {
WebShimKind shim = _webGetShimKind(config);
if (shim != WebShimKind_Share && shim != WebShimKind_Web) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);