Video Streaming on Blackberry

2019-03-17 00:34发布

Is there any way to stream and play video files from the server?

Does blackberry provide any built-in video player where I can play the streamed video?

2条回答
时光不老,我们不散
2楼-- · 2019-03-17 00:45

I'm using this code to open the built-in player (both for remote and local videos):

private void handleVideo(String url) {
    try {
        Invocation inv = new Invocation();

        if (url.startsWith("local")) {
            url = url.substring(url.lastIndexOf('/'));
            InputStream is = getClass().getResourceAsStream("/res" + url);
            if (is == null)
                return;
            // move resource to device memory so that we get an url which
            // can be passed to Invocation
            url = "file:///store/home/user/videos" + url;
            FileConnection dest = (FileConnection) Connector.open(url);
            if (!dest.exists())
                dest.create();
            dest.setWritable(true);
            OutputStream o = dest.openOutputStream();
            byte[] buf = new byte[8192];
            int length = -1;
            while ((length = is.read(buf)) > 0)
                o.write(buf, 0, length);
            o.close();
            is.close();
            dest.close();
        }

        inv.setID(BlackBerryContentHandler.ID_MEDIA_CONTENT_HANDLER);
        inv.setArgs(new String[] { BlackBerryContentHandler.MEDIA_ARGUMENT_VIEW_MEDIA });
        inv.setURL(url);
        Registry reg = Registry.getRegistry(getClass().getName());
        reg.invoke(inv);
    } catch (Throwable e) {
        UiApplication.getUiApplication().invokeAndWait(new RunnableDialog(e.getMessage()));
    }
}
查看更多
仙女界的扛把子
3楼-- · 2019-03-17 00:48

Yes you can. There are two ways to stream video on bb device:

  • using javax.microedition.media.Player from jsr-135
  • using standard Media Application

See How To - Play video within a BlackBerry smartphone application

You can test it over BlackBerry browser on http://m.youtube.com
How to watch YouTube Videos on BlackBerry Bold 9000

You will have to use WAP or WiFi protocol for RTSP:
Media application will switch to WAP for streaming media

Media types supported on the BlackBerry smartphone

查看更多
登录 后发表回答