三星智能电视 - 在仿真器中获取设备ID

时间:2015-01-26 07:20:33

标签: samsung-smart-tv

我完全是三星智能电视应用程序开发的新手。我正在尝试在应用程序运行时获取设备串行(MAC地址或任何唯一的字符串)。这就是我到目前为止所做的。

    <!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Test2</title>

    <!-- TODO : Common API -->
    <script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/API/Widget.js"></script>
    <script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/API/TVKeyValue.js"></script>


    <!-- TODO : Javascript code -->
    <script language="javascript" type="text/javascript" src="app/javascript/Main.js"></script>

    <!-- TODO : Style sheets code -->
    <link rel="stylesheet" href="app/stylesheets/Main.css" type="text/css">

    <!-- TODO: Plugins -->
    <script type="text/javascript">
    <script>
    function myFunction() {
       var networkPlugin = document.getElementById('pluginNetwork');
       var nnaviPlugin = document.getElementById('pluginObjectNNavi');
       var deviceId = nnaviPlugin.GetDUID(networkPlugin.GetHWaddr());

       document.getElementById('ss').innerHTML = nnaviPlugin;
    }
    </script>

    </script>

</head>

<body onload="lycaload();" bgcolor="#FFF" style="background:#FFF">

fgujhdfughufdghudfhgufghufhgfc
<object id='pluginNetwork' border=0 classid='clsid:SAMSUNG-INFOLINK-  NETWORK'></object>
<object id='pluginObjectNNavi' border=0 classid='clsid:SAMSUNG-INFOLINK-NNAVI'>  </object>
    <!-- Dummy anchor as focus for key events -->
      <a href="javascript:void(0);" id="anchor" onkeydown="Main.keyDown();">   </a>

    <div id="ss">
    </div>
   </body>
 </html>

此应用程序正在2014年三星智能电视仿真器5.1上进行测试,并在应用程序运行时不接收任何内容。请不要将此标记为重复。我已经关注了之前的Stackoverflow帖子,并没有得到任何运气..

1 个答案:

答案 0 :(得分:1)

从网络插件

你得到这样的MAC地址:

var mac = networkPlugin.GetMAC(0) || networkPlugin.GetMAC(1); // wired or wireless MAC address

if (!mac) {
    mac = 0;
}

console.log(String(mac).toUpperCase());

但我应该建议更好的解决方案是使用播放器中的唯一标识符(播放DRM内容有唯一ID)

<object id='EXTERNALWIDGET' border=0 classid='clsid:SAMSUNG-INFOLINK-EXTERNALWIDGETINTERFACE'>  </object>
try {
var externalPlugin= document.getElementById('EXTERNALWIDGET');

console.log(externalPlugin.GetESN("WIDEVINE"));
} catch (e) {
    return false;
}