Click here to Skip to main content
12,078,489 members (46,436 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: Java Mobile Blackberry
I used a code to play a song in blackberry.
public VideoPlaybackDemoScreen() {
		
		Class cl = null;
		
		try {
			cl = Class.forName("mypackage.VideoPlaybackDemoScreen");
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		if (cl != null) {
			try {
				InputStream is = getClass().getResourceAsStream(
						"/mzm.yzzwpvvt..640x348.h264lc.u.p.m4v");
				final Player player = javax.microedition.media.Manager
						.createPlayer(is, "video/m4v");
				player.realize();
 
				VideoControl videoControl = (VideoControl) player
						.getControl("VideoControl");
				Field videoField = (Field) videoControl.initDisplayMode(
						VideoControl.USE_GUI_PRIMITIVE,
						"net.rim.device.api.ui.Field");
				videoControl.setDisplaySize(480, 256);
				videoControl.setVisible(true);
 
				add(new LabelField("Top", 0));
				add(videoField);
				add(new LabelField("Bottom", 0));
				final int i = 30;
 
				final VolumeControl volume = (VolumeControl) player
						.getControl("VolumeControl");
				ButtonField volumeIncrease = new ButtonField("Volume Increase") {
					protected boolean navigationClick(int status, int time) {
						VolumeControl volC = (VolumeControl) player
								.getControl("VolumeControl");
						int volume = volC.getLevel() + 10;
						volC.setLevel(volume);
						Dialog.alert(String.valueOf(volume));
						return true;
					}
				};
				ButtonField volumeDecrease = new ButtonField("Volume Decrese") {
					protected boolean navigationClick(int status, int time) {
						VolumeControl volC = (VolumeControl) player
								.getControl("VolumeControl");
						int volume = volC.getLevel() - 10;
						volC.setLevel(volume);
						return true;
					}
				};
				add(volumeIncrease);
				add(volumeDecrease);
				player.start();
 
			} catch (IOException e) {
				Dialog.alert(e.getMessage());
			} catch (MediaException e) {
				Dialog.alert(e.getMessage());
			}
 
		}
	}

I used above code to play .m4a and .m4a songs. But when try to play .m4v songs, it gives an error message like "format is not supporting". If anybody knows how to play .m4v and .m4a songs in blackberry plaese let me know. thanks.
Posted 28-Oct-12 8:06am
Comments
TorstenH. 29-Oct-12 6:43am
   
Have you checked out the developer community @ Blackberry website?
You are getting into Blackberry-specific stuff more and more. You should go there, there might be more suitable solutions available.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web04 | 2.8.160212.1 | Last Updated 28 Oct 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100