Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 404
Registered: ‎05-31-2011
My Device: curve
My Carrier: devel

Re: http link using Manager.createPlayer()

i change it, nut i have this exception : peer refused the connection in the same line Manager.createPlayer
Trusted Contributor
Posts: 145
Registered: ‎05-01-2011
My Device: 9780
My Carrier: Developer

Re: http link using Manager.createPlayer()

Most probably the problem is with the url, Can you please check with this url http://daily3gp.com/vids/747.3gp, Since I've tested the above url with both simulator and device and it runs fine.

Developer
Posts: 404
Registered: ‎05-31-2011
My Device: curve
My Carrier: devel

Re: http link using Manager.createPlayer()

i try this url http://daily3gp.com/vids/747.3gp with 

;deviceside=true;interface=wifi

 and i get  IOException peer refused the connection

and without i get:  ExceptionHttp response 400

Trusted Contributor
Posts: 145
Registered: ‎05-01-2011
My Device: 9780
My Carrier: Developer

Re: http link using Manager.createPlayer()

For me it runs without any issue, I've used the same code and same url. Have you used this url?

 

Url = "http://daily3gp.com/vids/747.3gp;interface=wifi" 

Developer
Posts: 404
Registered: ‎05-31-2011
My Device: curve
My Carrier: devel

Re: http link using Manager.createPlayer()

i try it but i get the same exception peer refused connection!
Developer
Posts: 404
Registered: ‎05-31-2011
My Device: curve
My Carrier: devel

Re: http link using Manager.createPlayer()

can you post your complete code plz
Trusted Contributor
Posts: 145
Registered: ‎05-01-2011
My Device: 9780
My Carrier: Developer

Re: http link using Manager.createPlayer()

Try the same video url with blackberry browser and check whether you are able to  download or not? Also you are using WIFI connection, Have you set the correct APN settings? Is ther any firewall blocking?

Highlighted
Trusted Contributor
Posts: 145
Registered: ‎05-01-2011
My Device: 9780
My Carrier: Developer

Re: http link using Manager.createPlayer()

The following is the player class - You have to give player as input

 

public class VideoPlayScreen extends MainScreen implements PlayerListener {

    private VideoControl vc;

    public VideoPlayScreen(final Player player) {

        try {
            player.realize();
            final Canvas canvas = new MyCanvas();
            if ((vc = (VideoControl) player.getControl("VideoControl")) != null) {
                vc.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, canvas);
                vc.setDisplaySize(Display.getWidth(), Display.getHeight());
                vc.setVisible(true);
                player.prefetch();
                player.start();
            }
        } catch(final Exception e) {
            Logger.log(e);
        }
    }

    protected void makeMenu(final Menu menu, final int instance) {
        final Field focus = UiApplication.getUiApplication().getActiveScreen().getLeafFieldWithFocus();
        if (focus != null) {
            final ContextMenu contextMenu = focus.getContextMenu();
            if (!contextMenu.isEmpty()) {
                menu.add(contextMenu);
                menu.addSeparator();
            }
        }
        final MenuItem screen = new MenuItem("Full screen (F)", 50, 8) {
            public void run() {
                try {
                    vc.setDisplayFullScreen(true);
                } catch(final Exception e) {
                    Logger.log(e);
                }
            }
        };
        menu.add(screen);
        menu.addSeparator();
    }

    protected boolean keyChar(final char key, final int status, final int time) {
        boolean retVal = false;
        if (key == Characters.SPACE) {
            try {
                vc.setDisplayFullScreen(false);
            } catch(final Exception e) {
                Logger.log(e);
            }
            retVal = true;
        } else {
            return super.keyChar(key, status, time);
        }
        return retVal;
    }

    public void playerUpdate(final Player player, final String event, final Object eventData) {
        if("error".equals(event))
            Dialog.alert(String.valueOf(eventData));
        if("started".equals(event))
            UiApplication.getUiApplication().invokeLater(new Runnable() {
                public void run() {
                    try {
                        vc.setDisplayFullScreen(true);
                    } catch(final Exception e) {
                        Logger.log(e);
                    }
                }
            }, 1000L, false);
        if("stopped".equals(event))
            try {
                vc.setDisplayFullScreen(false);
            } catch(final Exception e) {
                Logger.log(e);
            }
    }
}

Trusted Contributor
Posts: 145
Registered: ‎05-01-2011
My Device: 9780
My Carrier: Developer

Re: http link using Manager.createPlayer()

You have to call that class

 

String url = "http://daily3gp.com/vids/747.3gp"; 

// append proper param like - ;deviceside=false, ;interface=wifi etc.,

final Player player = Manager.createPlayer(url);

net.rim.device.api.ui.UiApplication.getUiApplication().pushScreen(new VideoPlayScreen(player));

Trusted Contributor
Posts: 145
Registered: ‎05-01-2011
My Device: 9780
My Carrier: Developer

Re: http link using Manager.createPlayer()

Also am setting the video control display size as half the screen both width and height