The StreamNameAlias AddOn uses the IMediaStreamNameAliasProvider interface to resolve the playback names. In the default implementation, it does just resolve the name however, you could use your own implementation and use the resolvePlayAlias method as a point to get the file information you need before returning the full path.
There are a few thing to note.
- The path returned must be relative to the Streams/StorageDir set in the Application.xml. You should set your StorageDir to point to where the Nas storage is mounted (/mnt/). You would then return something like
- ../ is not allowed and will be removed.
- Any network lookups should be cached locally to avoid performance problems.
- If null is returned from the resolvePlayAlias methods, the player will receive an error. You can use this method to prevent playback.
- If doing ABR streaming (smil file), the resolvePlayAlias method will be called for the smil file and for each of the video files listed in the smil file. You should be sure to handle this.
- resolveStreamAlias is not needed in this case as it is only used for live mediaCaster connections.
Streaming directly from a network location such as Nas storage is not recommended as the network connection may cause a performance problem. Every play request for a file will open a separate connection to that file. For this reason, we recommend using the Mediacache AddOn which caches a local copy of the content that is requested. Multiple players will use the cached copy instead of hitting the storage directly.
With MediaCache, you can still use the aliasing to resolve the name and you are not restricted to where the StorageDir is pointing as it is not used. Instead, you would return the MediaCacheSource prefix followed by the asset path.
You can have a separate store listed for each Nas location or just have the top level folder as the store location.
From the resolvePlayAlias method, you would return something like this:
Separate Sources. Source path is /mnt/nas23/media/ and prefix is nas23/:
Single Source. Source path is /mnt/ and prefix is content1/:
Local storage for the MediaCache just needs to be large enough to handle the currently cached content and a small ssd drive would work fine in this case. You can adjust the TTL's to control how long content remains cached.