<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hi Andrey,<br>
    <br>
    Here you got the links.<br>
    <br>
    <a class="moz-txt-link-freetext" href="https://github.com/fidoraptor/harbour-facebook">https://github.com/fidoraptor/harbour-facebook</a><br>
    <br>
<a class="moz-txt-link-freetext" href="https://github.com/fidoraptor/harbour-facebook/blob/master/qml/pages/helper/mediaDetect.js">https://github.com/fidoraptor/harbour-facebook/blob/master/qml/pages/helper/mediaDetect.js</a><br>
    <pre class="moz-signature" cols="72">Vriendelijke groeten,

Rudi Timmermans.</pre>
    <div class="moz-cite-prefix">Op 08-03-16 om 11:16 schreef Andrey
      Kozhevnikov:<br>
    </div>
    <blockquote
      cite="mid:emb983dca3-1a7a-4985-b37c-ed2ab4a6ffc1@inspiron"
      type="cite">
      <style id="eMClientCss">blockquote.cite { margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc }
blockquote.cite2 {margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc; margin-top: 3px; padding-top: 0px; }
.plain pre, .plain tt { font-family: monospace; font-size: 100%; font-weight: normal; font-style: normal;}
a img { border: 0px; }body {font-family: Tahoma;font-size: 12pt;}
.plain pre, .plain tt {font-family: Tahoma;font-size: 12pt;}
</style>
      <style></style>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div>Maybe just add a link to repo and to lines inside files? That
        will be easier for people to help.</div>
      <div> </div>
      <div>------ Исходное сообщение ------</div>
      <div>От: "Rudi Timmermans" <<a moz-do-not-send="true"
          href="mailto:rudi.timmer@gmx.us">rudi.timmer@gmx.us</a>></div>
      <div>Кому: "Developers Mailing List SailfishOS" <<a
          moz-do-not-send="true"
          href="mailto:devel@lists.sailfishos.org"><a class="moz-txt-link-abbreviated" href="mailto:devel@lists.sailfishos.org">devel@lists.sailfishos.org</a></a>></div>
      <div>Отправлено: 08.03.2016 14:53:38</div>
      <div>Тема: [SailfishDevel] Embedded video play</div>
      <div> </div>
      <div class="plain" id="xfe92505c33384ed8babd64da4d8bd3e1">
        <blockquote class="cite2" cite="56DE9312.4010305@gmx.us"
          type="cite">
          <div>Hi,</div>
          <div> </div>
          <div>I have a problem here i try to autodetect the embedded
            video on a FB page that's posted.</div>
          <div> </div>
          <div>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.</div>
          <div> </div>
          <div>Thanks</div>
          <div> </div>
          <div>Here is the mediadetect.js script:</div>
          <div> </div>
          <div>function getImgFullUri(uri) {</div>
          <div>    if ((uri.slice(0, 7) === '<a class="moz-txt-link-freetext" href="http://">http://</a>') ||</div>
          <div>            (uri.slice(0, 8) === '<a class="moz-txt-link-freetext" href="https://">https://</a>') ||</div>
          <div>            (uri.slice(0, 7) === '<a class="moz-txt-link-freetext" href="file://">file://</a>')) {</div>
          <div>        return uri;</div>
          <div>    } else if (uri.slice(0, 1) === '/') {</div>
          <div>        var docuri = document.documentURI;</div>
          <div>        var firstcolon = docuri.indexOf('://');</div>
          <div>        var protocol = '<a class="moz-txt-link-freetext" href="http://">http://</a>';</div>
          <div>        if (firstcolon !== -1) {</div>
          <div>            protocol = docuri.slice(0, firstcolon + 3);</div>
          <div>        }</div>
          <div>        return protocol + document.domain + uri;</div>
          <div>    } else {</div>
          <div>        var base = document.baseURI;</div>
          <div>        var lastslash = base.lastIndexOf('/');</div>
          <div>        if (lastslash === -1) {</div>
          <div>            return base + '/' + uri;</div>
          <div>        } else {</div>
          <div>            return base.slice(0, lastslash + 1) + uri;</div>
          <div>        }</div>
          <div>    }</div>
          <div>}</div>
          <div>// ////</div>
          <div> </div>
          <div>// Detect HTML5 Video</div>
          <div>var delement =
            document.documentElement.getElementsByTagName('video');</div>
          <div> </div>
          <div>for (var i=0; i<delement.length; i++) {</div>
          <div>    if (delement[i].hasChildNodes()) {</div>
          <div>        console.debug("Has children");</div>
          <div>        var children = delement[i].childNodes;</div>
          <div>        for (var j = 0; j < children.length; j++) {</div>
          <div>            if (children[j].tagName === 'SOURCE') {</div>
          <div>                var data = new Object({'type': 'video'})</div>
          <div>                if (children[j].hasAttribute('src'))
            data.video = getImgFullUri(children[j].getAttribute('src'));</div>
          <div>                navigator.qt.postMessage(
            JSON.stringify(data) );</div>
          <div>                break;</div>
          <div>            }</div>
          <div>        }</div>
          <div>    }</div>
          <div>    else if (delement[i].hasAttribute('src')) {</div>
          <div>        var data = new Object({'type': 'video'})</div>
          <div>        data.video =
            getImgFullUri(delement[i].getAttribute('src'));</div>
          <div>        navigator.qt.postMessage( JSON.stringify(data) );</div>
          <div>    }</div>
          <div>}</div>
          <div>// ////</div>
          <div> </div>
          <div>// Detect embedded Youtube Video</div>
          <div> </div>
          <div>var frames =
            document.documentElement.getElementsByTagName('iframe');</div>
          <div>for (var i=0; i<frames.length; i++) {</div>
          <div>    var isrc = frames[i].getAttribute('src');</div>
          <div>    if (isrc.slice(0, 2) === '//') {</div>
          <div>        isrc = "http:" + isrc</div>
          <div>    }</div>
          <div>    var data = new Object({'type':'iframe'});</div>
          <div>    data.isrc = isrc;</div>
          <div>    navigator.qt.postMessage(JSON.stringify(data));</div>
          <div>}</div>
          <div> </div>
          <div>// mobilegeeks.de uses this</div>
          <div>var frames =
            document.documentElement.getElementsByTagName('pagespeed_iframe');</div>
          <div>for (var i=0; i<frames.length; i++) {</div>
          <div>    var isrc = frames[i].getAttribute('src');</div>
          <div>    if (isrc.slice(0, 2) === '//') {</div>
          <div>        isrc = "http:" + isrc</div>
          <div>    }</div>
          <div>    var data = new Object({'type':'iframe'});</div>
          <div>    data.isrc = isrc;</div>
          <div>    navigator.qt.postMessage(JSON.stringify(data));</div>
          <div>}</div>
          <div> </div>
          <div>// facebook.com uses this and detecting html5 video only
            does somehow not work</div>
          <div>var delement =
            document.documentElement.getElementsByClassName('widePic');</div>
          <div>for (var i=0; i<delement.length; i++) {</div>
          <div>    if (delement[i].hasChildNodes()) {</div>
          <div>        console.debug("Has children");</div>
          <div>        var children = delement[i].childNodes;</div>
          <div>        for (var j = 0; j < children.length; j++) {</div>
          <div>            if (children[j].hasAttribute('data-store')) {</div>
          <div>                var data = new Object({'type': 'video'})</div>
          <div>                var jsonFacebook =
            children[j].getAttribute('data-store')</div>
          <div>                // data.video = src of that above json</div>
          <div>                var objJSON = eval("(function(){return "
            + jsonFacebook + ";})()");</div>
          <div>                if (objJSON.type == "video") {</div>
          <div>                    data.video =
            getImgFullUri(objJSON.src)</div>
          <div>                    navigator.qt.postMessage(
            JSON.stringify(data) );</div>
          <div>                    break;</div>
          <div>                } // if type == video</div>
          <div> </div>
          <div>            } // if data-store</div>
          <div>        } // for</div>
          <div>    } // if children</div>
          <div>}</div>
          <div> </div>
          <div>--</div>
          <div>Vriendelijke groeten,</div>
          <div> </div>
          <div>Rudi Timmermans.</div>
          <div> </div>
          <div> </div>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to <a class="moz-txt-link-abbreviated" href="mailto:devel-unsubscribe@lists.sailfishos.org">devel-unsubscribe@lists.sailfishos.org</a></pre>
    </blockquote>
    <br>
  </body>
</html>