Re: [SailfishDevel] Embedded video play

2016-03-08 Thread Rudi Timmermans

Hi Andrey,

Here you got the links.

https://github.com/fidoraptor/harbour-facebook

https://github.com/fidoraptor/harbour-facebook/blob/master/qml/pages/helper/mediaDetect.js

Vriendelijke groeten,

Rudi Timmermans.

Op 08-03-16 om 11:16 schreef Andrey Kozhevnikov:
Maybe just add a link to repo and to lines inside files? That will be 
easier for people to help.

-- Исходное сообщение --
От: "Rudi Timmermans" mailto:rudi.tim...@gmx.us>>
Кому: "Developers Mailing List SailfishOS" <mailto:devel@lists.sailfishos.org>>

Отправлено: 08.03.2016 14:53:38
Тема: [SailfishDevel] Embedded video play

Hi,
I have a problem here i try to autodetect the embedded video on a FB 
page that's posted.
Normoly it should work like when mediadetect.js found the embedded 
video then it should ready out the video URL and show a pylly menu in 
may app the play the video with the external browser, but for some 
resion it dont read out the URL dont realy know, is there someone 
that can help me out with that.

Thanks
Here is the mediadetect.js script:
function getImgFullUri(uri) {
if ((uri.slice(0, 7) === 'http://') ||
(uri.slice(0, 8) === 'https://') ||
(uri.slice(0, 7) === 'file://')) {
return uri;
} else if (uri.slice(0, 1) === '/') {
var docuri = document.documentURI;
var firstcolon = docuri.indexOf('://');
var protocol = 'http://';
if (firstcolon !== -1) {
protocol = docuri.slice(0, firstcolon + 3);
}
return protocol + document.domain + uri;
} else {
var base = document.baseURI;
var lastslash = base.lastIndexOf('/');
if (lastslash === -1) {
return base + '/' + uri;
} else {
return base.slice(0, lastslash + 1) + uri;
}
}
}
// 
// Detect HTML5 Video
var delement = document.documentElement.getElementsByTagName('video');
for (var i=0; iif (children[j].hasAttribute('src')) data.video = 
getImgFullUri(children[j].getAttribute('src'));

navigator.qt.postMessage( JSON.stringify(data) );
break;
}
}
}
else if (delement[i].hasAttribute('src')) {
var data = new Object({'type': 'video'})
data.video = getImgFullUri(delement[i].getAttribute('src'));
navigator.qt.postMessage( JSON.stringify(data) );
}
}
// 
// Detect embedded Youtube Video
var frames = document.documentElement.getElementsByTagName('iframe');
for (var i=0; ivar frames = 
document.documentElement.getElementsByTagName('pagespeed_iframe');

for (var i=0; i// facebook.com uses this and detecting html5 video only does somehow 
not work
var delement = 
document.documentElement.getElementsByClassName('widePic');

for (var i=0; ivar objJSON = eval("(function(){return " + 
jsonFacebook + ";})()");

if (objJSON.type == "video") {
data.video = getImgFullUri(objJSON.src)
navigator.qt.postMessage( JSON.stringify(data) );
break;
} // if type == video
} // if data-store
} // for
} // if children
}
--
Vriendelijke groeten,
Rudi Timmermans.



___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org




smime.p7s
Description: S/MIME-cryptografische ondertekening
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] Embedded video play

2016-03-08 Thread Andrey Kozhevnikov
Maybe just add a link to repo and to lines inside files? That will be 
easier for people to help.


-- Исходное сообщение --
От: "Rudi Timmermans" 
Кому: "Developers Mailing List SailfishOS" 
Отправлено: 08.03.2016 14:53:38
Тема: [SailfishDevel] Embedded video play


Hi,

I have a problem here i try to autodetect the embedded video on a FB 
page that's posted.


Normoly it should work like when mediadetect.js found the embedded 
video then it should ready out the video URL and show a pylly menu in 
may app the play the video with the external browser, but for some 
resion it dont read out the URL dont realy know, is there someone that 
can help me out with that.


Thanks

Here is the mediadetect.js script:

function getImgFullUri(uri) {
if ((uri.slice(0, 7) === 'http://') ||
(uri.slice(0, 8) === 'https://') ||
(uri.slice(0, 7) === 'file://')) {
return uri;
} else if (uri.slice(0, 1) === '/') {
var docuri = document.documentURI;
var firstcolon = docuri.indexOf('://');
var protocol = 'http://';
if (firstcolon !== -1) {
protocol = docuri.slice(0, firstcolon + 3);
}
return protocol + document.domain + uri;
} else {
var base = document.baseURI;
var lastslash = base.lastIndexOf('/');
if (lastslash === -1) {
return base + '/' + uri;
} else {
return base.slice(0, lastslash + 1) + uri;
}
}
}
// 

// Detect HTML5 Video
var delement = document.documentElement.getElementsByTagName('video');

for (var i=0; iif (children[j].hasAttribute('src')) data.video = 
getImgFullUri(children[j].getAttribute('src'));

navigator.qt.postMessage( JSON.stringify(data) );
break;
}
}
}
else if (delement[i].hasAttribute('src')) {
var data = new Object({'type': 'video'})
data.video = getImgFullUri(delement[i].getAttribute('src'));
navigator.qt.postMessage( JSON.stringify(data) );
}
}
// 

// Detect embedded Youtube Video

var frames = document.documentElement.getElementsByTagName('iframe');
for (var i=0; ivar frames = 
document.documentElement.getElementsByTagName('pagespeed_iframe');

for (var i=0; i// facebook.com uses this and detecting html5 video only does somehow 
not work
var delement = 
document.documentElement.getElementsByClassName('widePic');

for (var i=0; ivar jsonFacebook = 
children[j].getAttribute('data-store')

// data.video = src of that above json
var objJSON = eval("(function(){return " + jsonFacebook 
+ ";})()");

if (objJSON.type == "video") {
data.video = getImgFullUri(objJSON.src)
navigator.qt.postMessage( JSON.stringify(data) );
break;
} // if type == video

} // if data-store
} // for
} // if children
}

--
Vriendelijke groeten,

Rudi Timmermans.

___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

[SailfishDevel] Embedded video play

2016-03-08 Thread Rudi Timmermans

Hi,

I have a problem here i try to autodetect the embedded video on a FB 
page that's posted.


Normoly it should work like when mediadetect.js found the embedded video 
then it should ready out the video URL and show a pylly menu in may app 
the play the video with the external browser, but for some resion it 
dont read out the URL dont realy know, is there someone that can help me 
out with that.


Thanks

Here is the mediadetect.js script:

function getImgFullUri(uri) {
if ((uri.slice(0, 7) === 'http://') ||
(uri.slice(0, 8) === 'https://') ||
(uri.slice(0, 7) === 'file://')) {
return uri;
} else if (uri.slice(0, 1) === '/') {
var docuri = document.documentURI;
var firstcolon = docuri.indexOf('://');
var protocol = 'http://';
if (firstcolon !== -1) {
protocol = docuri.slice(0, firstcolon + 3);
}
return protocol + document.domain + uri;
} else {
var base = document.baseURI;
var lastslash = base.lastIndexOf('/');
if (lastslash === -1) {
return base + '/' + uri;
} else {
return base.slice(0, lastslash + 1) + uri;
}
}
}
// 

// Detect HTML5 Video
var delement = document.documentElement.getElementsByTagName('video');

for (var i=0; iif (children[j].hasAttribute('src')) data.video = 
getImgFullUri(children[j].getAttribute('src'));

navigator.qt.postMessage( JSON.stringify(data) );
break;
}
}
}
else if (delement[i].hasAttribute('src')) {
var data = new Object({'type': 'video'})
data.video = getImgFullUri(delement[i].getAttribute('src'));
navigator.qt.postMessage( JSON.stringify(data) );
}
}
// 

// Detect embedded Youtube Video

var frames = document.documentElement.getElementsByTagName('iframe');
for (var i=0; ivar frames = 
document.documentElement.getElementsByTagName('pagespeed_iframe');

for (var i=0; i// facebook.com uses this and detecting html5 video only does somehow 
not work

var delement = document.documentElement.getElementsByClassName('widePic');
for (var i=0; ivar objJSON = eval("(function(){return " + jsonFacebook 
+ ";})()");

if (objJSON.type == "video") {
data.video = getImgFullUri(objJSON.src)
navigator.qt.postMessage( JSON.stringify(data) );
break;
} // if type == video

} // if data-store
} // for
} // if children
}

--

Vriendelijke groeten,

Rudi Timmermans.




smime.p7s
Description: S/MIME-cryptografische ondertekening
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org