• /
  • EnglishEspañol日本語한국어Português
  • ログイン今すぐ開始

この機械翻訳は、参考として提供されています。

英語版と翻訳版に矛盾がある場合は、英語版が優先されます。詳細については、このページを参照してください。

問題を作成する

イベントキャプチャを有効にする

Roku デバイス用の New Relic メディア エージェントは、ビデオ コンテンツの再生中に発生するイベントをキャプチャします。 このドキュメントでは、キャプチャできるイベントの概要と、Roku アプリケーションでそれらを有効にする方法について説明します。

自動イベント キャプチャを有効にするには、以下で説明する手順を実行します。

メインの BrightScript ファイル (例: Main.brs) で、NewRelic 関数を呼び出し、返されたオブジェクトを保存します。

アプリケーションの開始イベントをログに記録するには、 nrAppStarted呼び出します。

(オプション) NewRelicSystemStartNewRelicVideoStartを使用して、システム イベントとビデオ イベントのキャプチャを開始します。

メインの待機ループで、 nrProcessMessageを呼び出してシステム イベントを処理します。

以下は、 New Relicエージェントを Roku アプリケーションに統合する基本的な例です。

メイン.brs

sub Main(aa as Object)
screen = CreateObject("roSGScreen")
m.port = CreateObject("roMessagePort")
screen.setMessagePort(m.port)
'Create the main scene that contains a video player
scene = screen.CreateScene("VideoScene")
screen.show()
'Init New Relic Agent
m.nr = NewRelic(ACCOUNT ID,API KEY)
'Send APP_STARTED event
nrAppStarted(m.nr, aa)
'Pass NewRelicAgent object to the main scene
scene.setField("nr", m.nr)
'Activate system tracking
m.syslog = NewRelicSystemStart(m.port)
while (true)
msg = wait(0, m.port)
if nrProcessMessage(m.nr, msg) = false
'It is not a system message captured by New Relic Agent
if type(msg) = "roPosterScreenEvent"
if msg.isScreenClosed()
exit while
end if
end if
end if
end while
end sub

ビデオシーン.xml

<?xml version="1.0" encoding="utf-8" ?>
<component name="VideoScene" extends="Scene">
<interface>
<!-- Field used to pass the NewRelicAgent object to the scene -->
<field id="nr" type="node" onChange="nrRefUpdated" />
</interface>
<children>
<Video
id="myVideo"
translation="[0,0]"
/>
</children>
<!-- New Relic Agent Interface -->
<script type="text/brightscript" uri="pkg:/source/NewRelicAgent.brs"/>
<script type="text/brightscript" uri="pkg:/components/VideoScene.brs"/>
</component>

ビデオシーン.brs [#videoscene.brs]

sub init()
m.top.setFocus(true)
setupVideoPlayer()
end sub
function nrRefUpdated()
m.nr = m.top.nr
'Activate video tracking
NewRelicVideoStart(m.nr, m.video)
end function
function setupVideoPlayer()
videoUrl = "http://..."
videoContent = createObject("RoSGNode", "ContentNode")
videoContent.url = videoUrl
videoContent.title = "Any Video"
m.video = m.top.findNode("myVideo")
m.video.content = videoContent
m.video.control = "play"
end function
Copyright © 2025 New Relic株式会社。

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.