/// <summary> /// Loads the webpage contents from specified file. /// </summary> /// <param name="_HTMLFilePath">Path of the target file, to use as contents of the webpage.</param> /// <param name="_baseURL">The base URL for the content.</param> public void LoadHTMLStringContentsOfFile(string _HTMLFilePath, string _baseURL) { DownloadAsset _request = new DownloadAsset(URLAddress.FileURLWithPath(_HTMLFilePath), true); _request.OnCompletion = (WWW _www, string _error) => { if (string.IsNullOrEmpty(_error)) { LoadHTMLString(_www.text, _baseURL); } else { Console.LogError(Constants.kDebugTag, "[WebView] The operation could not be completed. Error=" + _error); return; } }; _request.StartRequest(); }
public override void PlayVideoFromURL (URL _URL, PlayVideoCompletion _onCompletion) { base.PlayVideoFromURL(_URL, _onCompletion); if (!string.IsNullOrEmpty(_URL.URLString)) { string _youtubeID = ExtractYoutubeVideoID(_URL.URLString); if(_youtubeID != null) { PlayYoutubeVideo(_youtubeID, _onCompletion); } else { Plugin.Call(Native.Methods.PLAY_VIDEO_FROM_URL, _URL.URLString); } } }
public override void PlayVideoFromURL (URL _URL, PlayVideoCompletion _onCompletion) { base.PlayVideoFromURL(_URL, _onCompletion); if (!string.IsNullOrEmpty(_URL.URLString)) { // Check if this url is a youtube link string _youtubeID = ExtractYoutubeVideoID(_URL.URLString); if(_youtubeID != null) { PlayYoutubeVideo(_youtubeID, _onCompletion); } else { playVideoFromURL(_URL.URLString); } } }
/// <summary> /// Play video from specified URL. This can be an URL pointing to local/remote file. /// </summary> /// <remarks>\warning This URL needs to point directly to the video. Direct video link ex: www.voxelbusters.com/movie.mp4 </remarks> /// <param name="_URL">URL of the video to play.</param> /// <param name="_onCompletion">Callback triggered on completion or failure. see <see cref="ePlayVideoFinishReason"/> for status.</param> public virtual void PlayVideoFromURL (URL _URL, PlayVideoCompletion _onCompletion) { // Pause unity player this.PauseUnity(); // Cache callback OnPlayVideoFinished = _onCompletion; if (string.IsNullOrEmpty(_URL.URLString)) { Console.LogError(Constants.kDebugTag, "[MediaLibrary] Play video from URL failed, URL can't be null"); PlayVideoFinished(ePlayVideoFinishReason.PLAYBACK_ERROR); return; } }
public DownloadTexture (URL _URL, bool _isAsynchronous, bool _autoFixOrientation) : base(_URL, _isAsynchronous) { AutoFixOrientation = _autoFixOrientation; WWWObject = new WWW(_URL.URLString); ScaleFactor = 1f; }
public override void PlayVideoFromURL (URL _URL, PlayVideoCompletion _onCompletion) { base.PlayVideoFromURL(_URL, _onCompletion); if (!string.IsNullOrEmpty(_URL.URLString)) { Application.OpenURL(_URL.URLString); PlayVideoFinished(ePlayVideoFinishReason.PLAYBACK_ENDED); } }
protected void RequestForImageFinished (URL _imagePathURL, string _error) { if (_error != null) { DownloadImageFinished(null, _error); return; } else { DownloadTexture _newRequest = new DownloadTexture(_imagePathURL, true, true); _newRequest.OnCompletion = (Texture2D _image, string _downloadError)=>{ // Invoke handler DownloadImageFinished(_image, _downloadError); }; _newRequest.StartRequest(); } }
public DownloadAssetBundle(URL _URL, int _version, bool _isAsynchronous) : base(_URL, _isAsynchronous) { WWWObject = WWW.LoadFromCacheOrDownload(_URL.URLString, _version); }
protected Request(URL _URL, bool _isAsynchronous) { this.URL = _URL; this.IsAsynchronous = _isAsynchronous; }
public DownloadAssetBundle(URL _URL, int _version, bool _isAsynchronous) : base(_URL, _isAsynchronous) { #pragma warning disable CS0618 // Type or member is obsolete WWWObject = WWW.LoadFromCacheOrDownload(_URL.URLString, _version); #pragma warning restore CS0618 // Type or member is obsolete }
public static GETRequest CreateAsyncRequest(URL _URL, object _params) { GETRequest _request = new GETRequest(_URL, _params, true); return(_request); }
public static GETRequest CreateRequest (URL _URL, object _params) { GETRequest _request = new GETRequest(_URL, _params, false); return _request; }
public GETRequest(URL _URL, object _params, bool _isAsynchronous) : base(_URL, _params, _isAsynchronous) { WWWObject = CreateWWWObject(); }
public static GETRequest CreateRequest(URL _URL, object _params) { GETRequest _request = new GETRequest(_URL, _params, false); return(_request); }
public WebRequest(URL _URL, object _params, bool _isAsynchronous) : base(_URL, _isAsynchronous) { this.Parameters = _params; }
public DownloadAsset(URL _URL, bool _isAsynchronous) : base(_URL, _isAsynchronous) { WWWObject = new WWW(_URL.URLString); }
/// <summary> /// Saves an image from the specified url to gallery/media library of the users device. /// \note The path needs to be absolute path if its local file. Take care of the path on multiple platforms as the file structure will be different. /// </summary> /// <param name="_URL">URL to pick the source from. This can be a file url existing on local storage or a web url at remote location.</param> /// <param name="_onCompletion">Callback triggered once save to gallery is done.</param> public void SaveImageToGallery (URL _URL, SaveImageToGalleryCompletion _onCompletion) { // Download texture from given URL DownloadTexture _newDownload = new DownloadTexture(_URL, true, false); _newDownload.OnCompletion = (Texture2D _texture, string _error)=>{ // Save downloaded texture if (!string.IsNullOrEmpty(_error)) { Console.LogError(Constants.kDebugTag, "[MediaLibrary] Texture download failed, URL=" + _URL.URLString); } // Save image SaveImageToGallery(_texture, _onCompletion); }; // Start download _newDownload.StartRequest(); }
public POSTRequest (URL _URL, object _params, bool _isAsynchronous) : base(_URL, _params, _isAsynchronous) { WWWObject = CreateWWWObject(); }
public WebRequest (URL _URL, object _params, bool _isAsynchronous) : base(_URL, _isAsynchronous) { this.Parameters = _params; }
public DownloadTexture(URL _URL, bool _isAsynchronous, bool _autoFixOrientation) : base(_URL, _isAsynchronous) { AutoFixOrientation = _autoFixOrientation; WWWObject = new WWW(_URL.URLString); ScaleFactor = 1f; }
public static POSTRequest CreateAsyncRequest (URL _URL, object _params) { POSTRequest _request = new POSTRequest(_URL, _params, false); return _request; }
public static GETRequest CreateAsyncRequest (URL _URL, object _params) { GETRequest _request = new GETRequest(_URL, _params, true); return _request; }