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

BlackBerry® Desktop Software

Reply
New Contributor
eng_a7medsamer
Posts: 3
Registered: ‎03-27-2012
My Device: 9930

“Unsupported Type” when playing live video stream on BlackBerry

I am trying to play live video from an ip camera on my blackberry device. I am getting an unsupported type exception when trying to play the video.


package com.bb.play;

import javax.microedition.media.Player;
import javax.microedition.media.Manager;
import javax.microedition.media.control.VideoControl;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.system.Characters;

/**
*
*/
public final class PlayVideo extends UiApplication
{

private Player player;
private VideoControl videoControl;


public static void main(String[] args)
{
PlayVideo theApp = new PlayVideo();
theApp.enterEventDispatcher();
}

public PlayVideo()
{
MainScreen ms = new MainScreen(){

public boolean onClose()
{
//Clean up the player resources.
player.close();
videoControl.setVisible(false);
close();
return true;
}

//Override keyChar to capture key commands used to control video playback.
protected boolean keyChar(char c, int status, int time)
{
boolean retVal = false;

if (c == Characters.SPACE)
{
if (player.getState() == Player.STARTED)
{
//Stop playback.
try
{
player.stop();
}
catch (Exception ex)
{
System.out.println("Exception: " + ex.toString());
}
}
else
{
//Start playback.
try
{
player.start();
}
catch (Exception ex)
{
System.out.println("Exception: " + ex.toString());
}
}

retVal = true;
}

return retVal;
}
};

ms.setTitle(new LabelField("Let's play some video..."));
LabelField lf = new LabelField("Press space to start/stop/resume playback.");
ms.add(lf);
pushScreen(ms);

try
{
//Create a new Player pointing to the video file.
//This can use any valid URL.
player = Manager.createPlayer("http://camera1.mairie-brest.fr/axis-cgi/mjpg/video.cgi");
player.realize();

//Create a new VideoControl.
videoControl = (VideoControl)player.getControl("VideoControl");
//Initialize the video mode using a Field.
videoControl.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");

//Set the video control to be visible.
videoControl.setVisible(true);
}
catch (Exception ex)
{
System.out.println(ex.toString());
}
}
}


New Contributor
eng_a7medsamer
Posts: 3
Registered: ‎03-27-2012
My Device: 9930

Re: “Unsupported Type” when playing live video stream on BlackBerry

where's the answer ?

BlackBerry Development Advisor
MSohm
Posts: 14,864
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: “Unsupported Type” when playing live video stream on BlackBerry

The video format used in that stream is not supported on BlackBerry Smartphones.  Refer to this document for a list of supported formats.

 

Supported Media Types on BlackBerry Smartphones Reference Guide

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker