C
C
chornaya2013-12-11 11:54:55
API
chornaya, 2013-12-11 11:54:55

How to load custom videos using chrome.mediaGalleries?

Hello, I can't deal with the chrome.mediaGalleries API for the second day. Documentation is poor and there is only one example.
What you need:
get the user's video from the local directory that he specifies;
generate a preview of his video (if any are found in the directory);
Maybe someone has already dealt with this API?
The manifest and app>background>script are taken from github.

{
  "name": "Media Gallery Sample",
  "version": "0.2.1",
  "manifest_version": 2,
  "description": "Used to test Media Gallery API",
  "permissions": [{
      "mediaGalleries": ["read", "allAutoDetected"] 
  }],
  "icons": {
    "128": "mga-128color.png"
  },
  "app": {
     "background": {
       "scripts": ["runtime.js"]
     }
  }
}

runtime.js
chrome.app.runtime.onLaunched.addListener(function(data) {
    chrome.app.window.create('page.html', 
            {bounds: {width:900, height:600}, minWidth:900, maxWidth: 900, minHeight:600, maxHeight: 600, id:"MGExp"}, 
            function(app_win) {
                    app_win.contentWindow.__MGA__bRestart = false;
            }
    );
    console.log("app launched");
});

chrome.app.runtime.onRestarted.addListener(function() {
    chrome.app.window.create('page.html', 
            {bounds: {width:900, height:600}, minWidth:900, maxWidth: 900, minHeight:600, maxHeight: 600, id:"MGExp"}, 
            function(app_win) {
                    app_win.contentWindow.__MGA__bRestart = true;
            }
    );
    console.log("app restarted");
});

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question