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
jtp5120
Posts: 298
Registered: ‎05-02-2010
My Device: Bold 9700
Accepted Solution

Opening 3GP video, how do I supress Open or Save Dialog for a device Browser?

How do I design the following?

 

A user clicks on a 3GP video link which pops open the device's Browser using:

 

 

private void launchBrowser(int browserType, String url) {
  BrowserSession browserSession = createBrowserSession(browserType);
  browserSession.displayPage(url);
  browserSession.showBrowser();
}

 

 

The Browser opens but the user is presented a Dialog with the statement "Do you want to open or save the item?" plus an Open, Save and Cancel button.

 

If the user selects Open, the 3GP file plays without issue.

I would rather the 3GP video just plays for the user.

  1. Is there a way to supress the Open or Save Dialog for the device Browser?
  2. Is this designed wrong and should I use a BrowserField?
  3. I would rather find a way to get the following working, but I'm running out of time...

 

public final class PlayVideo implements PlayerListener {

private Player player;
private VideoControl videoControl;

private Video video;

public PlayVideo(Video video) {
this.video = video;
}

public void openVideoFullUrl() {
final String url = video.getVideoURL();

if (url != null) {
Runnable r = new Runnable() {
public void run() {
new Browser(url);
}
};

new Thread(r, "Event").start();
}
}

public void openVideo() {

try {
if (this.video.getVideoURL() != null) {
int transportType = 0;
TransportDetective td = new TransportDetective();

if (td.isCoverageAvailable(TransportDetective.TRANSPORT_TCP_CELLULAR)) {
transportType = TransportDetective.TRANSPORT_TCP_CELLULAR;
} else if (td
	.isCoverageAvailable(TransportDetective.TRANSPORT_WAP)) {
transportType = TransportDetective.TRANSPORT_WAP;
} else if (td
	.isCoverageAvailable(TransportDetective.TRANSPORT_WAP2)) {
transportType = TransportDetective.TRANSPORT_WAP2;
} else if (td
	.isCoverageAvailable(TransportDetective.TRANSPORT_MDS)) {
transportType = TransportDetective.TRANSPORT_MDS;
} else if (td
	.isCoverageAvailable(TransportDetective.TRANSPORT_BIS_B)) {
transportType = TransportDetective.TRANSPORT_BIS_B;
} else if (td
	.isCoverageAvailable(TransportDetective.TRANSPORT_TCP_WIFI)) {
transportType = TransportDetective.TRANSPORT_TCP_WIFI;
}

HTTPRequestRunnable getData = new HTTPRequestRunnable(
	video.getVideoURL(), null, transportType, false);
getData.run();

String errorMessage = getData.getErrorMessage();
if (errorMessage == null) {
if (getData.gotResponse()) {
	byte[] response = getData.getResponse();
	if (response.length > 0) {
	  // URL without suffix.
		String redirectedUrl = getData
				.getCleanConnectionURL();

		player = Manager.createPlayer(redirectedUrl);
		player.setLoopCount(1);
		player.prefetch();
		player.realize();

		videoControl = (VideoControl) player
				.getControl("VideoControl");
		videoControl.initDisplayMode(
				VideoControl.USE_DIRECT_VIDEO, this);
		videoControl.setVisible(true);

	}
}
}
}
} catch (IllegalStateException e) {
Logger.logEventWarn("[PlayVideo] Illegal state: " + e.getMessage());
} catch (IllegalArgumentException e) {
Logger.logEventWarn("[PlayVideo] Illegal arg: " + e.getMessage());
} catch (SecurityException e) {
Logger.logEventWarn("[PlayVideo] Security: " + e.getMessage());
} catch (Exception e) {
Logger.logEventWarn("[PlayVideo] " + e.getMessage());
}
}

public void playerUpdate(Player player, String event, Object eventData) {
if (event == PlayerListener.BUFFERING_STARTED) {
Logger.debug("[PlayVideo] BUFFERING_STARTED.");
} else if (event == PlayerListener.BUFFERING_STOPPED) {
Logger.debug("[PlayVideo] BUFFERING_STOPPED.");
} else if (event == PlayerListener.STARTED) {
Logger.debug("[PlayVideo] STARTED.");
} else if (event == PlayerListener.STOPPED) {
Logger.debug("[PlayVideo] STOPPED.");
} else if (event == PlayerListener.ERROR) {
Logger.debug("[PlayVideo] ERROR.");
} else if (event == PlayerListener.END_OF_MEDIA) {
Logger.debug("[PlayVideo] END_OF_MEDIA.");
}
}
}

 

 

--Todd

Windows 7 Enterprise 64-bit (6.1 Build 7600) | Java SE Runtime Environment (build 1.6.0_24-b07) | Eclipse Version: 3.6.2 [M20110210-1200] | BlackBerry Eclipse Plug-in: 1.3.0.201102031007-19 | Java Compiler level: 1.3 | Targeting devices running OS 5 | Simulators: JDE 5.0 packaged 9700, 9630, 9300
BlackBerry Development Advisor
MSohm
Posts: 14,757
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: Opening 3GP video, how do I supress Open or Save Dialog for a device Browser?

Have you tried to invoke the media application directly using the content handler (CHAPI) API?

 

Invoke the Media application

http://supportforums.blackberry.com/t5/Java-Development/Invoke-the-Media-application/ta-p/442964

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
Contributor
Gunj
Posts: 26
Registered: ‎01-18-2011
My Device: Not Specified

Re: Opening 3GP video, how do I supress Open or Save Dialog for a device Browser?

Chapi Invocation is not work for video urls suggest  us what should we do for supress prompt open save

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

Re: Opening 3GP video, how do I supress Open or Save Dialog for a device Browser?

Can you give an example of a video URL that fails to open with CHAPI?  What BlackBerry Smartphone model and BlackBerry device software version are you testing on?  You can find this under Options, About on the BlackBerry Smartphone.

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
Contributor
Gunj
Posts: 26
Registered: ‎01-18-2011
My Device: Not Specified

Re: Opening 3GP video, how do I supress Open or Save Dialog for a device Browser?

Thanks for reply M Sohm,

 

video url's  are  runnging  perfectly using

 

   private void launchBrowser(int browserType, String url) {
BrowserSession browserSession = createBrowserSession(browserType);
browserSession.displayPage(url);
browserSession.showBrowser();
}

  only the problem is it prompt's open save dialog box to user

 

by CHAPI invocation it will show a blank white screen nothing will display,as company policies I cant provide you url but

same as http://myserver.com/abc.mp4,

 

I have Blackberry 9800 smartphone(3g,wifi)v6.0.0246(Bundle 695,Plateform 6.4..105),media version1.1

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

Re: Opening 3GP video, how do I supress Open or Save Dialog for a device Browser?

What behaviour are you seeing if you type in the same URL in the browser?  The API should mirror that.

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
Contributor
Gunj
Posts: 26
Registered: ‎01-18-2011
My Device: Not Specified

Re: Opening 3GP video, how do I supress Open or Save Dialog for a device Browser?

Hi ,

 Browser has showing  open save dialog box for that  url how I supress this dialog box

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

Re: Opening 3GP video, how do I supress Open or Save Dialog for a device Browser?

You could download the video, store it on the user's microSD card and open from there.

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