How to download video using samsung tv api?

812 Views Asked by At

Basically I am developing web application for Samsung TV.

I am trying to download image and videos from Server and then displaying it.

var contentdownload = function () {
   var url = 'https://dwdvhqfdmesuz.cloudfront.net/5bb5b552ab41a237a95db866/5bb5b618ab41a237a95db86b.jpeg';

    var download_api_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/download");
    var wifi_capability = tizen.systeminfo.getCapability("http://tizen.org/feature/network.wifi");



    var listener = {
        onprogress: function(id, receivedSize, totalSize) {
            console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
        },
        onpaused: function(id) {
            console.log('Paused with id: ' + id);
        },
        oncanceled: function(id) {
            console.log('Canceled with id: ' + id);
        },
        oncompleted: function(id, path) {
            console.log('Completed with id: ' + id + ', path: ' + path);
        },
        onfailed: function(id, error) {
            console.log('Failed with id: ' + id + ', error: ' , error); // returning error
        }
    };

var downloadRequest = new tizen.DownloadRequest(url, "Downloads");
var downloadId = tizen.download.start(downloadRequest, listener);

}

Error : enter image description here

Thanks

1

There are 1 best solutions below

1
On

There is a typo in the code: try to change "Downloads" to "downloads".

Filesystem on Tizen uses virtual roots, you can check all available folder names here: https://developer.samsung.com/tv/develop/api-references/tizen-web-device-api-references/filesystem-api

If you have further problems you can compare your solution with Download API demo: https://github.com/SamsungDForum/Download

Another thing is that (unless you have a special scenario in your application) avplay (Tizen video player) will handle downloading video for you and so will HTML image tag.