Java Code Examples for org.telegram.tgnet.ConnectionsManager#FileTypeVideo
The following examples show how to use
org.telegram.tgnet.ConnectionsManager#FileTypeVideo .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileLoadOperation.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public FileLoadOperation(int instance, WebFile webDocument) { currentAccount = instance; webFile = webDocument; webLocation = webDocument.location; totalBytesCount = webDocument.size; initialDatacenterId = datacenterId = MessagesController.getInstance(currentAccount).webFileDatacenterId; String defaultExt = FileLoader.getExtensionByMime(webDocument.mime_type); if (webDocument.mime_type.startsWith("image/")) { currentType = ConnectionsManager.FileTypePhoto; } else if (webDocument.mime_type.equals("audio/ogg")) { currentType = ConnectionsManager.FileTypeAudio; } else if (webDocument.mime_type.startsWith("video/")) { currentType = ConnectionsManager.FileTypeVideo; } else { currentType = ConnectionsManager.FileTypeFile; } allowDisordererFileSave = true; ext = ImageLoader.getHttpUrlExtension(webDocument.url, defaultExt); }
Example 2
Source File: FileLoadOperation.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public FileLoadOperation(int instance, WebFile webDocument) { currentAccount = instance; webFile = webDocument; webLocation = webDocument.location; totalBytesCount = webDocument.size; initialDatacenterId = datacenterId = MessagesController.getInstance(currentAccount).webFileDatacenterId; String defaultExt = FileLoader.getExtensionByMime(webDocument.mime_type); if (webDocument.mime_type.startsWith("image/")) { currentType = ConnectionsManager.FileTypePhoto; } else if (webDocument.mime_type.equals("audio/ogg")) { currentType = ConnectionsManager.FileTypeAudio; } else if (webDocument.mime_type.startsWith("video/")) { currentType = ConnectionsManager.FileTypeVideo; } else { currentType = ConnectionsManager.FileTypeFile; } allowDisordererFileSave = true; ext = ImageLoader.getHttpUrlExtension(webDocument.url, defaultExt); }
Example 3
Source File: FileLoadOperation.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
public FileLoadOperation(int instance, WebFile webDocument) { currentAccount = instance; webFile = webDocument; webLocation = webDocument.location; totalBytesCount = webDocument.size; initialDatacenterId = datacenterId = MessagesController.getInstance(currentAccount).webFileDatacenterId; String defaultExt = FileLoader.getMimeTypePart(webDocument.mime_type); if (webDocument.mime_type.startsWith("image/")) { currentType = ConnectionsManager.FileTypePhoto; } else if (webDocument.mime_type.equals("audio/ogg")) { currentType = ConnectionsManager.FileTypeAudio; } else if (webDocument.mime_type.startsWith("video/")) { currentType = ConnectionsManager.FileTypeVideo; } else { currentType = ConnectionsManager.FileTypeFile; } allowDisordererFileSave = true; ext = ImageLoader.getHttpUrlExtension(webDocument.url, defaultExt); }
Example 4
Source File: FileLoadOperation.java From Telegram with GNU General Public License v2.0 | 6 votes |
public FileLoadOperation(int instance, WebFile webDocument) { currentAccount = instance; webFile = webDocument; webLocation = webDocument.location; totalBytesCount = webDocument.size; initialDatacenterId = datacenterId = MessagesController.getInstance(currentAccount).webFileDatacenterId; String defaultExt = FileLoader.getMimeTypePart(webDocument.mime_type); if (webDocument.mime_type.startsWith("image/")) { currentType = ConnectionsManager.FileTypePhoto; } else if (webDocument.mime_type.equals("audio/ogg")) { currentType = ConnectionsManager.FileTypeAudio; } else if (webDocument.mime_type.startsWith("video/")) { currentType = ConnectionsManager.FileTypeVideo; } else { currentType = ConnectionsManager.FileTypeFile; } allowDisordererFileSave = true; ext = ImageLoader.getHttpUrlExtension(webDocument.url, defaultExt); }
Example 5
Source File: FileLoadOperation.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
public FileLoadOperation(TLRPC.Document documentLocation) { try { if (documentLocation instanceof TLRPC.TL_documentEncrypted) { location = new TLRPC.TL_inputEncryptedFileLocation(); location.id = documentLocation.id; location.access_hash = documentLocation.access_hash; initialDatacenterId = datacenterId = documentLocation.dc_id; iv = new byte[32]; System.arraycopy(documentLocation.iv, 0, iv, 0, iv.length); key = documentLocation.key; } else if (documentLocation instanceof TLRPC.TL_document) { location = new TLRPC.TL_inputDocumentFileLocation(); location.id = documentLocation.id; location.access_hash = documentLocation.access_hash; initialDatacenterId = datacenterId = documentLocation.dc_id; allowDisordererFileSave = true; } totalBytesCount = documentLocation.size; if (key != null) { int toAdd = 0; if (totalBytesCount % 16 != 0) { bytesCountPadding = 16 - totalBytesCount % 16; totalBytesCount += bytesCountPadding; } } ext = FileLoader.getDocumentFileName(documentLocation); int idx; if (ext == null || (idx = ext.lastIndexOf('.')) == -1) { ext = ""; } else { ext = ext.substring(idx); } if ("audio/ogg".equals(documentLocation.mime_type)) { currentType = ConnectionsManager.FileTypeAudio; } else if ("video/mp4".equals(documentLocation.mime_type)) { currentType = ConnectionsManager.FileTypeVideo; } else { currentType = ConnectionsManager.FileTypeFile; } if (ext.length() <= 1) { if (documentLocation.mime_type != null) { switch (documentLocation.mime_type) { case "video/mp4": ext = ".mp4"; break; case "audio/ogg": ext = ".ogg"; break; default: ext = ""; break; } } else { ext = ""; } } } catch (Exception e) { FileLog.e(e); onFail(true, 0); } }
Example 6
Source File: FileLoadOperation.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
public FileLoadOperation(TLRPC.Document documentLocation) { try { if (documentLocation instanceof TLRPC.TL_documentEncrypted) { location = new TLRPC.TL_inputEncryptedFileLocation(); location.id = documentLocation.id; location.access_hash = documentLocation.access_hash; initialDatacenterId = datacenterId = documentLocation.dc_id; iv = new byte[32]; System.arraycopy(documentLocation.iv, 0, iv, 0, iv.length); key = documentLocation.key; } else if (documentLocation instanceof TLRPC.TL_document) { location = new TLRPC.TL_inputDocumentFileLocation(); location.id = documentLocation.id; location.access_hash = documentLocation.access_hash; initialDatacenterId = datacenterId = documentLocation.dc_id; allowDisordererFileSave = true; } totalBytesCount = documentLocation.size; if (key != null) { int toAdd = 0; if (totalBytesCount % 16 != 0) { bytesCountPadding = 16 - totalBytesCount % 16; totalBytesCount += bytesCountPadding; } } ext = FileLoader.getDocumentFileName(documentLocation); int idx; if (ext == null || (idx = ext.lastIndexOf('.')) == -1) { ext = ""; } else { ext = ext.substring(idx); } if ("audio/ogg".equals(documentLocation.mime_type)) { currentType = ConnectionsManager.FileTypeAudio; } else if ("video/mp4".equals(documentLocation.mime_type)) { currentType = ConnectionsManager.FileTypeVideo; } else { currentType = ConnectionsManager.FileTypeFile; } if (ext.length() <= 1) { if (documentLocation.mime_type != null) { switch (documentLocation.mime_type) { case "video/mp4": ext = ".mp4"; break; case "audio/ogg": ext = ".ogg"; break; default: ext = ""; break; } } else { ext = ""; } } } catch (Exception e) { FileLog.e(e); onFail(true, 0); } }
Example 7
Source File: FileLoadOperation.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public FileLoadOperation(TLRPC.Document documentLocation, Object parent) { try { parentObject = parent; if (documentLocation instanceof TLRPC.TL_documentEncrypted) { location = new TLRPC.TL_inputEncryptedFileLocation(); location.id = documentLocation.id; location.access_hash = documentLocation.access_hash; initialDatacenterId = datacenterId = documentLocation.dc_id; iv = new byte[32]; System.arraycopy(documentLocation.iv, 0, iv, 0, iv.length); key = documentLocation.key; } else if (documentLocation instanceof TLRPC.TL_document) { location = new TLRPC.TL_inputDocumentFileLocation(); location.id = documentLocation.id; location.access_hash = documentLocation.access_hash; location.file_reference = documentLocation.file_reference; location.thumb_size = ""; if (location.file_reference == null) { location.file_reference = new byte[0]; } initialDatacenterId = datacenterId = documentLocation.dc_id; allowDisordererFileSave = true; for (int a = 0, N = documentLocation.attributes.size(); a < N; a++) { if (documentLocation.attributes.get(a) instanceof TLRPC.TL_documentAttributeVideo) { supportsPreloading = true; break; } } } ungzip = "application/x-tgsticker".equals(documentLocation.mime_type) || "application/x-tgwallpattern".equals(documentLocation.mime_type); totalBytesCount = documentLocation.size; if (key != null) { int toAdd = 0; if (totalBytesCount % 16 != 0) { bytesCountPadding = 16 - totalBytesCount % 16; totalBytesCount += bytesCountPadding; } } ext = FileLoader.getDocumentFileName(documentLocation); int idx; if (ext == null || (idx = ext.lastIndexOf('.')) == -1) { ext = ""; } else { ext = ext.substring(idx); } if ("audio/ogg".equals(documentLocation.mime_type)) { currentType = ConnectionsManager.FileTypeAudio; } else if (FileLoader.isVideoMimeType(documentLocation.mime_type)) { currentType = ConnectionsManager.FileTypeVideo; } else { currentType = ConnectionsManager.FileTypeFile; } if (ext.length() <= 1) { ext = FileLoader.getExtensionByMimeType(documentLocation.mime_type); } } catch (Exception e) { FileLog.e(e); onFail(true, 0); } }
Example 8
Source File: FileLoadOperation.java From Telegram with GNU General Public License v2.0 | 4 votes |
public FileLoadOperation(TLRPC.Document documentLocation, Object parent) { try { parentObject = parent; if (documentLocation instanceof TLRPC.TL_documentEncrypted) { location = new TLRPC.TL_inputEncryptedFileLocation(); location.id = documentLocation.id; location.access_hash = documentLocation.access_hash; initialDatacenterId = datacenterId = documentLocation.dc_id; iv = new byte[32]; System.arraycopy(documentLocation.iv, 0, iv, 0, iv.length); key = documentLocation.key; } else if (documentLocation instanceof TLRPC.TL_document) { location = new TLRPC.TL_inputDocumentFileLocation(); location.id = documentLocation.id; location.access_hash = documentLocation.access_hash; location.file_reference = documentLocation.file_reference; location.thumb_size = ""; if (location.file_reference == null) { location.file_reference = new byte[0]; } initialDatacenterId = datacenterId = documentLocation.dc_id; allowDisordererFileSave = true; for (int a = 0, N = documentLocation.attributes.size(); a < N; a++) { if (documentLocation.attributes.get(a) instanceof TLRPC.TL_documentAttributeVideo) { supportsPreloading = true; break; } } } ungzip = "application/x-tgsticker".equals(documentLocation.mime_type) || "application/x-tgwallpattern".equals(documentLocation.mime_type); totalBytesCount = documentLocation.size; if (key != null) { int toAdd = 0; if (totalBytesCount % 16 != 0) { bytesCountPadding = 16 - totalBytesCount % 16; totalBytesCount += bytesCountPadding; } } ext = FileLoader.getDocumentFileName(documentLocation); int idx; if (ext == null || (idx = ext.lastIndexOf('.')) == -1) { ext = ""; } else { ext = ext.substring(idx); } if ("audio/ogg".equals(documentLocation.mime_type)) { currentType = ConnectionsManager.FileTypeAudio; } else if (FileLoader.isVideoMimeType(documentLocation.mime_type)) { currentType = ConnectionsManager.FileTypeVideo; } else { currentType = ConnectionsManager.FileTypeFile; } if (ext.length() <= 1) { ext = FileLoader.getExtensionByMimeType(documentLocation.mime_type); } } catch (Exception e) { FileLog.e(e); onFail(true, 0); } }