2

サーバーからビデオ ファイルをストリーミングして再生する方法はありますか?

Blackberry には、ストリーミングされたビデオを再生できる組み込みのビデオ プレーヤーが用意されていますか?

4

2 に答える 2

7

はい、できます。bbデバイスでビデオをストリーミングする方法は2つあります。

  • jsr-135のjavax.microedition.media.Playerを使用
  • 標準のメディアアプリケーションを使用する

方法を参照してください-BlackBerryスマートフォンアプリケーション内でビデオを再生します

http://m.youtube.comのBlackBerryブラウザでテストできます。BlackBerryBold9000で
YouTubeビデオを視聴する方法

RTSPにはWAPまたはWiFiプロトコルを使用する必要があります。
メディアアプリケーションはストリーミングメディア用にWAPに切り替わります

BlackBerryスマートフォンでサポートされているメディアタイプ

于 2009-09-19T15:50:17.990 に答える
1

このコードを使用して組み込みプレーヤーを開きます (リモート ビデオとローカル ビデオの両方)。

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()));
    }
}
于 2011-09-14T13:07:21.683 に答える