IOS-Does kaltura Native Player supports offline videos

i have list of videos locally stored in the app. i want to play the videos in kaltura player which i stored in application.

Could some one suggest any idea how to implement offline videos to play in kaltura navive player

Hi, if the app downloads the content, Kaltura SDK can play it

i am also very interested in this. Basically the functionality to download a video or store it and view it while offline with the kaltura player and Mobile SDK. Can this be bumped up in priority to get a response from relevant devs please.

Thanks

Hey @iddrew1,

Kaltura iOS/ Android player SDK already supports offline playback.

Here is a doc you can use to try and implement offline playback:

Let us know if you have more questions.

Best,
Eliza

Hi Eliza
Can we have any demo for offline videos and how it work in kaltura native player.

Hi @elizas

Thank you for your reply and the doco.

We have tried as suggested in the document using your test project and we are close but still havn’t 100% achieved full offline playback. Is there any chance that you could provide us with a few test lines on how to get it to work in your test project please. What we are trying to achieve is having a video file saved to local storage on the mobile device, and then played back using a kaltura player.

So far we have managed this:

  1. download file
  2. we register the file via the asset manager
  3. it tries to play but it still tries to call the server to download the uiconfig data for the player

So, we need some assistance to find a way to cache the player / uiconfig for pure offline viewing.

This is the code for our main activity:

    private void downloadVideo() {

    String entryId = "0_504v7ss3";
    final String ks = KSessionHelper.CreateKSession(PARTNER_ID, SECRET, USER_TYPE);
    flavorId = FlavorAssetHelper.getHighestBitrateFlavorIdByEntryId(ks, entryId);
    String downloadUrl = FlavorAssetHelper.getDownloadUrl(ks, flavorId);

    final KPPlayerConfig config = new KPPlayerConfig(MainActivity.SERVICE_URL, MainActivity.UICONF_ID, MainActivity.PARTNER_ID);
    config.setEntryId(entryId);
    config.addConfig("autoPlay", "true");
    config.addConfig("streamerType", "hls");
    config.setKS(ks);

    Toast.makeText(getApplicationContext(), "Download in progress...", Toast.LENGTH_LONG).show();

    VideoDownloader downloader = new VideoDownloader(getApplicationContext(), "firstVideo", new VideoDownloader.VideoDownloaderListener() {
        @Override
        public void onDownloadFinished(String fileName) {
            SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
            SharedPreferences.Editor editor = settings.edit();
            editor.putString("fileName", fileName);
            editor.putString("ks", ks);
            editor.apply();

            LocalAssetsManager.registerAsset(getContext(), config, flavorId, fileName, new LocalAssetsManager.AssetRegistrationListener() {
                @Override
                public void onRegistered(String assetPath) {

                }

                @Override
                public void onFailed(String assetPath, Exception error) {

                }
            });

            Toast.makeText(getApplicationContext(), "Download finished", Toast.LENGTH_LONG).show();
        }

        @Override
        public void onProgressUpdated(float progress) {

        }
    });

    downloader.execute(downloadUrl);
}

and this is from the player segment:

    public String getURL(String entryId, String currentURL) {
    SharedPreferences settings = getActivity().getSharedPreferences(MainActivity.PREFS_NAME, 0);
    String url = settings.getString("fileName", "");
    return url;
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    Bundle bundle = this.getArguments();
    boolean local = bundle.getBoolean("local");

    // Inflate the layout for this fragment
    if(mFragmentView == null) {
        mFragmentView = inflater.inflate(R.layout.fragment_main, container, false);
        mPlayerView = (PlayerViewController) mFragmentView.findViewById(R.id.player);
        mPlayerView.loadPlayerIntoActivity(getActivity());

        String entryId = "0_504v7ss3";
        KPPlayerConfig config = new KPPlayerConfig(MainActivity.SERVICE_URL, MainActivity.UICONF_ID, MainActivity.PARTNER_ID);
        config.setEntryId(entryId);
        config.addConfig("autoPlay", "true");
        config.addConfig("streamerType", "hls");

        if (local) {
            mPlayerView.setCustomSourceURLProvider(this);
            SharedPreferences settings = getActivity().getSharedPreferences(MainActivity.PREFS_NAME, 0);
            String ks = settings.getString("ks", "");
            config.setKS(ks);
        } else {
            String ks = KSessionHelper.CreateKSession(MainActivity.PARTNER_ID, MainActivity.SECRET, MainActivity.USER_TYPE);
            config.setKS(ks);
        }

        mPlayerView.initWithConfiguration(config);



        // Add swipe rcogniser
        final GestureDetector gestureDetector = new GestureDetector(getActivity(), new CustomeGestureDetector());
        mPlayerView.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                return gestureDetector.onTouchEvent(event);
            }
        });
    }


    return mFragmentView;
}

playerFragment implements the PlayerViewController.SourceURLProvider interface, so basically download works, also local playback of video is working, we just need to be able to store player code locally and push it to the player somehow otherwise if device is offline it’s not playing because cannot load the player

Hi,

The SDK saves the cached pages by the url, so when you see the call it because the web view will go to the cache and will look for it.
I see that you didn’t supply localContentId and because of that you can’t play it offline

Thanks,
Nisso