Skip to main content

Error trying to play video - Code Attached, Does anyone know how to do this

No replies
em_pleh
Offline
Joined: 2008-12-12
Points: 0

Hello fellow BD-J fingers,

I for some reason cannot get my Xlet to play video in the background and have triple checked my playlist and m2ts. the error I get is "create Player error, uncorrect DataSourcebd://PLAYLIST:00000
"

Thank you in advance for the help.

<br />
package com.homebrew;</p>
<p>import java.io.*;<br />
import java.util.*;<br />
import java.awt.*;<br />
import java.net.*;</p>
<p>import javax.media.*;<br />
import javax.tv.xlet.*;</p>
<p>import org.bluray.ui.event.HRcEvent;<br />
import org.dvb.event.UserEvent;<br />
import org.dvb.event.EventManager;<br />
import org.dvb.event.UserEventListener;<br />
import org.dvb.event.UserEventRepository;<br />
import org.havi.ui.*;</p>
<p>import javax.media.Player;<br />
import org.bluray.net.BDLocator;<br />
import org.davic.media.MediaLocator;</p>
<p>public class HelloTVXlet extends Container implements Xlet, Runnable, UserEventListener {</p>
<p>    private static Font font;<br />
    private HScene scene;<br />
    private XletContext context;<br />
    private Thread myWorkerThread;<br />
    private boolean running = true;<br />
    private MediaTracker tracker;<br />
    private int iCount = 0;<br />
    private img_background bg;<br />
    private animation_ballerina mod_ballerina;<br />
    private menu_tier1 tier1;</p>
<p>    /** Creates a new instance of HelloTVXlet */<br />
    public HelloTVXlet() {<br />
    }</p>
<p>    public void initXlet(XletContext context) {<br />
        this.context = context;</p>
<p>        scene = HSceneFactory.getInstance().getDefaultHScene();<br />
        tracker = new MediaTracker(this);</p>
<p>        try {<br />
            setSize(1920, 1080); // BD screen size<br />
            scene.add(this, BorderLayout.CENTER);<br />
            font = new Font(null, Font.PLAIN, 36);</p>
<p>            //Load Modules<br />
            mod_ballerina = new animation_ballerina(tracker);<br />
            bg = new img_background(tracker);<br />
            tier1 = new menu_tier1(tracker);</p>
<p>            UserEventRepository userEventRepo = new UserEventRepository("evt");<br />
            userEventRepo.addAllArrowKeys();<br />
            userEventRepo.addAllColourKeys();<br />
            userEventRepo.addAllNumericKeys();<br />
            userEventRepo.addKey(HRcEvent.VK_ENTER);<br />
            userEventRepo.addKey(HRcEvent.VK_POPUP_MENU);<br />
            EventManager.getInstance().addUserEventListener(this, userEventRepo);</p>
<p>            MediaLocator stars = new MediaLocator(new BDLocator(null, -1, 0, -1, -1, null));<br />
            Player player = Manager.createPlayer(stars);<br />
            player.prefetch();<br />
            player.start();</p>
<p>        } catch (Exception e) {<br />
            System.out.println("Print Error" + e.getMessage());<br />
        }<br />
        scene.validate();<br />
    }</p>
<p>    public void startXlet() {<br />
        scene.setVisible(true);<br />
        requestFocus();</p>
<p>        myWorkerThread = new Thread(this);<br />
        myWorkerThread.start();<br />
    }</p>
<p>   public void run() {<br />
        while (running) {<br />
            try {<br />
                myWorkerThread.sleep(50);<br />
                iCount =  iCount + 1;<br />
                if(iCount == 24){<br />
                    iCount = 0;<br />
                }<br />
            } catch (InterruptedException e) {<br />
                System.out.println("run error");<br />
                e.printStackTrace();<br />
            }</p>
<p>            repaint();<br />
            scene.repaint();<br />
        }<br />
    }</p>
<p>   public void userEventReceived(UserEvent e) {<br />
       if (e.getType() == HRcEvent.KEY_RELEASED) {<br />
            switch(e.getCode()){<br />
            case HRcEvent.VK_ENTER:</p>
<p>                break;<br />
            }<br />
       }</p>
<p>        if (e.getType() == HRcEvent.KEY_PRESSED) {<br />
            switch(e.getCode()){</p>
<p>            case HRcEvent.VK_POPUP_MENU:<br />
                //popupKeyPressed();<br />
                break;</p>
<p>            case HRcEvent.VK_0:<br />
            case HRcEvent.VK_1:<br />
            case HRcEvent.VK_2:<br />
            case HRcEvent.VK_3:<br />
            case HRcEvent.VK_4:<br />
            case HRcEvent.VK_5:<br />
            case HRcEvent.VK_6:<br />
            case HRcEvent.VK_7:<br />
            case HRcEvent.VK_8:<br />
            case HRcEvent.VK_9:<br />
                //numberKeyPressed(e.getCode() - HRcEvent.VK_0);<br />
                break;</p>
<p>            case HRcEvent.VK_COLORED_KEY_0:<br />
            case HRcEvent.VK_COLORED_KEY_1:<br />
            case HRcEvent.VK_COLORED_KEY_2:<br />
            case HRcEvent.VK_COLORED_KEY_3:<br />
            case HRcEvent.VK_COLORED_KEY_4:<br />
            case HRcEvent.VK_COLORED_KEY_5:<br />
                //colorKeyPressed(e.getCode() - HRcEvent.VK_COLORED_KEY_0);<br />
                break;</p>
<p>            case HRcEvent.VK_ENTER:<br />
                tier1.handleEnterPressed();<br />
                break;</p>
<p>            case HRcEvent.VK_LEFT:</p>
<p>                break;</p>
<p>            case HRcEvent.VK_RIGHT:</p>
<p>                break;</p>
<p>            case HRcEvent.VK_UP:<br />
                tier1.handleUp();<br />
                break;</p>
<p>            case HRcEvent.VK_DOWN:<br />
                tier1.handleDown();<br />
                break;</p>
<p>            }<br />
        }<br />
        repaint();<br />
        scene.repaint();<br />
    }</p>
<p>    public void paint(Graphics g) {<br />
        //bg.paint(g);<br />
        tier1.paint(g);<br />
        mod_ballerina.paint(g, iCount);<br />
    }</p>
<p>    public void pauseXlet() {</p>
<p>    }</p>
<p>    public void destroyXlet(boolean unconditional) {<br />
        scene = null;<br />
    }<br />
}</p>
<p>

Message was edited by: em_pleh