clappr/dash-shaka-playback

Shaka namespace needed

Closed this issue · 3 comments

To integrate P2P Media Loader engine with Shaka Player in Clappr we need both: shaka player instance and shaka namespace object. Namespace object is not available.

function registerParserProxies() {
    debug("register parser proxies");
    shaka.media.ManifestParser.registerParserByExtension("mpd", ShakaDashManifestParserProxy);
    shaka.media.ManifestParser.registerParserByMime("application/dash+xml", ShakaDashManifestParserProxy);
    shaka.media.ManifestParser.registerParserByExtension("m3u8", ShakaHlsManifestParserProxy);
    shaka.media.ManifestParser.registerParserByMime("application/x-mpegurl", ShakaHlsManifestParserProxy);
    shaka.media.ManifestParser.registerParserByMime("application/vnd.apple.mpegurl", ShakaHlsManifestParserProxy);
}

function initializeNetworkingEngine() {
    debug("init networking engine");
    shaka.net.NetworkingEngine.registerScheme("http", processNetworkRequest);
    shaka.net.NetworkingEngine.registerScheme("https", processNetworkRequest);
}

See details:
https://github.com/Novage/p2p-media-loader/blob/master/p2p-media-loader-shaka/lib/integration.ts

Can you make somehow the namespace available to hook into shaka.net and shaka.media before Shaka Player object creation? For example:

var shakaNamespace = DashShakaPlayback.getShakaNamespace();

Maybe simply add a getter, like we did for HLSJS playback, for example :

  static get SHAKA() {
    return shaka
  }

And the player instance should be available with the shakaPlayerInstance getter. (if created)

Thanks you two =) I'll bring @towerz and @vagnervjs I think @kslimani idea's seems pretty solid.

Hello guys.
We (me and @mrlika) managed to make all work without this change. We have used "external" version of your library (which comes without bundled ShakaPlayer and relies on global "shaka" included before the library). This way our library and your one uses same "shaka".