# Class e.c.m.MediaFile(object):

Part of elisa.core.media_file View In Hierarchy

This class provides a file-like API to access data at a given URI.

MediaFiles are created by `elisa.core.components.media_provider.MediaProvider` objects. They act as proxies to the latter, thus are bound to MediaProviders.

Instance Variables | descriptor | media descriptor symbolizing the opened media (type: object )

Line # | Kind | Name | Docs
--- | --- | --- | ---
39 | Method | __init__ |
51 | Method | close | Close myself via my media_provider
56 | Method | descriptor__get | Descriptor readonly access
61 | Method | read | Read some data from my descriptor using my media_provider
72 | Method | seek | Seek to given offset of my descriptor, via my media_provider

def __init__(self, media_provider, descriptor):

Parameters | media_provider | the Component which provides media access to the descriptor, hence the media URI (type: `elisa.core.components.media_provider.MediaProvider` )
| descriptor | media descriptor symbolizing the opened media (type: object )

def close(self):
Close myself via my media_provider

def descriptor__get(self):
Descriptor readonly access

def read(self, size=-1):
Read some data from my descriptor using my media_provider

Parameters | size | length of data to retrieve. The media_provider will do its best to fetch that amount of data. size = -1 means retrieving all available data at once (type: int )
Returns | string

def seek(self, offset, whence=0):
Seek to given offset of my descriptor, via my media_provider

Parameters | offset | how much to seek in the file (type: int )
| whence | from where to seek in the file, default=0 means current position (type: int )
Returns | bool