Пример #1
0
    def fromFilePath(path, url, ip, to, mimeType = None, caption = None):
        preview = VideoTools.generatePreviewFromVideo(path)
        entity = DownloadableMediaMessageProtocolEntity.fromFilePath(path, url, DownloadableMediaMessageProtocolEntity.MEDIA_TYPE_VIDEO, ip, to, mimeType, preview)
        entity.__class__ = VideoDownloadableMediaMessageProtocolEntity

        width, height, bitrate, duration = VideoTools.getVideoProperties(path)
        assert width, "Could not determine video properties"

        duration = int(duration)
        entity.setVideoProps('raw', width, height, bitrate, duration=duration, seconds=duration, caption=caption)
        return entity
    def fromFilePath(path, url, ip, to, mimeType = None, caption = None):
        preview = VideoTools.generatePreviewFromVideo(path)
        entity = DownloadableMediaMessageProtocolEntity.fromFilePath(path, url, DownloadableMediaMessageProtocolEntity.MEDIA_TYPE_VIDEO, ip, to, mimeType, preview)
        entity.__class__ = VideoDownloadableMediaMessageProtocolEntity

        width, height, bitrate, duration = VideoTools.getVideoProperties(path)
        assert width, "Could not determine video properties"

        duration = int(duration)
        entity.setVideoProps('raw', width, height, duration=duration, seconds=duration, caption=caption)
        return entity