Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

playing a part of video without cutting


Hi There,

I am quite new bee in player stuff.

Please, may I know that it is possible to play a video for provided start time and end time. For eg- if my video is 20 minutes long, I want my client to be able to watch only from 6 minute to 14 minute video without changing my original video. I know ffpmeg plugin can cut this video to a desired length (here for eg -9 minute), and will generate new video with 9 min length. But I dont want to increase my database size.

I apologies if i am not explaining my problem in straightforward words, coz I am not a english native speaker.

Thank you in advance!!

18 Community Answers

Todd

JW Player Support Agent  
1 rated :

Hi,

You can use our API to jump to 360 (six minutes as written in seconds) and then stop playback at 840. Here’s a sample of what the code would look like:

jwplayer().onPlay(function() {
setTimeout(function()
{ jwplayer().seek(30); }, 500);
});

jwplayer().onTime(function() {
if (jwplayer().getPosition() >= ‘45’) {
jwplayer().play(false);
}
});

Please note the setTimeout() is to assure the video will jump to the desired time in Flash mode.

Hope this helps,
Todd

bansalpreeti07

User  
0 rated :

Thanks a lot Todd for your support. It is working as per my requirement.

One more thing, may I know, please that, as I have to show control seek bar to my clients, so it is looking bit strange kind of, when video starts at 6 min and finish at 14 min-for example.

Is it possible to hide rest of durations from seek bar? I mean seek bar could display duration as 9 minutes or is there any start and duration properties in JW player, which we can directly use for displaying content for 9 minutes with 9 minutes seek bar out of 20 minutes long video.

Thanks once again for your help!!

Todd

JW Player Support Agent  
-2 rated :

No, there is no way to do this. You could hide the controls completely and then use our Javascript API to build your own individual buttons (play, pause, etc) with the appropriate API calls. Please see our full Javascript API reference at http://support.jwplayer.com/customer/portal/articles/1413089-javascript-api-reference for more details.

bansalpreeti07

User  
0 rated :

Thanks again Todd for your quick reply.

I found the start and duration properties for JW player on following link....

http://people.csail.mit.edu/jieyunfu/mediaplayer/JW%20Player%20Quick%20Start%20Guide.pdf

If you will move down to playlist heading. In that it show s around 10 properties, including start and duration, is it not available now in JW player.

One more thing can I make my own moving seek bar with desired duration, using JW player API?

Sorry for bothering you again.

Thanks again!!

Todd

JW Player Support Agent  
0 rated :

That document you found references JW 5. Stat and duration are no longer valid parameters in a JW 6 setup.

I do not know a way to edit the seek bar to adjust for the new start and end points. Perhaps the best way to achieve what you are trying to do with the seek bar is to make a copy of the video and remove the unwanted portions.

bansalpreeti07

User  
0 rated :

Hi Todd,

I have tried start and duration in JW 5.10 version, in that as well it is not working, Is there any specific requirements in term of syntax in this 5.10 version for using start and duration properties?

I cant do cut and copy for my requirements as it will increase my database size.

Anyway, as per your last suggestion, for my requirements I made control = false in my player and happy, that have successfully added customised control bar in html5, the only thing, I am facing now is....when I am seeking video for a predefined time point for example 55th sec, initially before seeking to that point, video plays for first 0 second to around 3-5 seconds, then seeks to predefined position (55th second). Any solution for this please?

Thanks for your all support.

Todd

JW Player Support Agent  
1 rated :

You could do a few things to minimize the amount of time the video plays starting at zero before it jumps to the desired start point. Let me first start by explaining that in Flash mode, our player cannot start a video by seeking (but it can in HTML5 mode) so we use a setTimeout as soon as the player starts in order to jump to the desired start point. You can play around with the timeout code:

setTimeout(function() { jwplayer().seek(30); }, 500 );

The last number is the delay in milliseconds. Too short and the player might not be set up in time to respond. Too long of a delay will cause the user to see a few seconds of video from zero before it seeks to the desired spot.

Another option seems heavy-handed, but you could potentially start the player muted with height and width set to 0, then seek to the desired time, then resize the player to the desired size and unmute. This way the user would not hear or see anything until the video was at the desired time. I haven’t tested this idea, but it might work by implementing some other API calls like resize() and setVolume().

See the full API reference document at http://support.jwplayer.com/customer/portal/articles/1413089-javascript-api-reference

bansalpreeti07

User  
0 rated :

Hi Todd,

I have implemented my jwplayer 6's custom control bar.....now the weird problem, I found..is my JW6 is not working in FF browser. Do you have any idea please, that what can be the reason. I have the following link for showing you...

http://test.etv.org.nz/newPlayer/sample_player.php#

It works fine on safari, chrome, but not on firefox....please help on this.

Thanks

bansalpreeti07

User  
0 rated :

I found that I am using flashplayer parameter in player setup, which was stopping to setting up player on firefox. When i commented it, player is working fine. but I am still not understanding why? My FF and chrome, both are flash 14.0 installed and html5 video supported. When i Call getRenderingMode() method, it returns flash on FF and HTML5. I would like to know why it is setting different mode on different browsers, while both browsers having support for both mode. Is there any preference setting in JW player for different browser for setting different modes(flash/html5).

One more thing , I would like to know, is it possible to set 2 modes(html5 and flash) with one default, in setup block of JW6, as it was in JW5?

Thanks

bansalpreeti07

User  
0 rated :

Hi Todd,

My last post was so silly, i know!! In JW 6 there is auto switching between modes with by default html5 as primary.

Thanks for your all support on going through JW player , as being a new bee on coding and player things.

Todd

JW Player Support Agent  
0 rated :

Sorry I did not reply sooner. I was out of the office on Friday.

Our player detects the capabilities of the current browser when it loads. If your browser can natively play HTML5 video, our player will go into HTML5 mode. If your browser cannot natively play the video, our player switches over to Flash mode. The default rendering mode for our player is HTML5, but you can override this by setting primary: ‘flash’ in your setup.

Hope this helps,
Todd

bansalpreeti07

User  
0 rated :

Hi Todd,

Yes this helped me a lot!!

One thing I found with my mozilla browser now. My FF says it has support for HTML5 video, but when I played a video on FF, with html5 primary, defining purposely to make it play with html5 only forcefully (I know it is by default). It stiil playes video in flash mode. FYI, I am detecting browsers availability only by your javascript code, as following -

<script type="text/javascript">

var version = '0,0,0,0';

var hasflash = document.getElementById('hasflash');

var hasvideo = document.getElementById('hasvideo');

try {

try {

var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');

try { axo.AllowScriptAccess = 'always'; }

catch(e) { version = '6,0,0'; }

} catch(e) {}

version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable(

'$version').replace(/D+/g, ',').match(/^,?(.+),?$/)[1];

} catch(e) {

try {

if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){

version = (navigator.plugins["Shockwave Flash 2.0"] ||

navigator.plugins["Shockwave Flash"]).description.replace(/D+/g, ",").match(/^,?(.+),?$/)[1];

}

} catch(e) {}

}

if(version == '0,0,0,0') {

hasflash.innerHTML = "Your browser has not installed Adobe Flash";

} else {

hasflash.innerHTML = "Your browser has installed Adobe Flash "+version;

}

if(!!document.createElement('video').canPlayType) {

hasvideo.innerHTML = "Your browser includes support for HTML5 video";

} else {

hasvideo.innerHTML = "Your browser does not support HTML5 video";

}

</script>


Next thing, I am facing, is ....due to above mentioned issue, For FF , if I play my video as http stream, it first buffers full video , then plays, it takes lots of time to start playing (even in my case I want to play only 1 minutes video out of 128 minute video). So I tried with rtmp stream, so that It can buffer for few secs and start playing. rtmp works fine until I am not using seek functionality to seek my video to 61th second. If I seeks to any part of video, it keep buffering forever.

Following is the link, u can see my player with rtmp streaming -

http://test.etv.org.nz/embed_new.php?m=single&id=72287&lib=0

Which is keep buffering, after seeking to desired point of time.

If could get help on this issue, would be really great!!

Thanks



bansalpreeti07

User  
0 rated :

And also forget to one more thing....that why my logo has lost its opacity effect, while it was working fine in jwplayer5, please ?

Or i need to customise logo too to a customised button in doc with opacity effect on mouse hover?

Thanks

Todd

JW Player Support Agent  
0 rated :

You shouldn’t have to do any browser or Flash sniffing in your code. Our player does all that for you automatically. One other note is that RTMP streams will always force our player into Flash mode, unless you have also specified an HTML5 source and the browser can play that file back natively.

As for the opacity of your logo, your best bet might be to adjust the opacity of the actual logo in a graphics editor before you upload it to your server. I know you can use CSS to adjust the image when our player is in HTML5 mode, but I am not sure how you can do something similar when the player is in Flash mode.

bansalpreeti07

User  
0 rated :

Hi Todd,

Thanks for your reply.

I was doing browser or flash sniffing into my code only for my confirmations, thats not a problem.

My main issue is now...is as I mentioned in may last post, that.... If suppose I am giving html5 as primary mode, providing both streams - http and rtmp, & my FF browser does not support either html5 mode or .mp4 type, so browser start with rtmp streaming. Till now it works fine. Problem starts when I try to seek to a position, in jwplayer (for ex. 61th sec) on play event using following code -

jwplayer().onPlay(){
jwplayer().seek(61);
});

OR

jwplayer().onPlay() {
setTimeout(function()
{ jwplayer().seek(61); }, 20);
});


player after coming out from buffering state, bring screen to 61th second frame, then goes into again buffer state for forever.

Is there any solution, for it, please!!

Also, regarding logo issue... Actually same logo was working fine...which I mean, that it was having opacity around .5 by default, itself, and on hover on it, it was getting opacity 1. Now for same logo, it is getting opacity 1 all time. As you mentioned in your last suggestion for this, I will try with turning opacity down in a graphic editer, if this is only we can do in JW 6. Still my preference is to give same effect as was in jw5, default opacity .5, hover on- opacity 1, hover out - .5 again.



Thanks a lot for your time spending for replying me.

Todd

JW Player Support Agent  
0 rated :

Which version of Firefox are you using? And which OS are you using? Do you have the updated Flash plugin installed?

bansalpreeti07

User  
0 rated :

My FF browser has installed Adobe Flash Shockwave Flash 14.0 r0. I believe it has updated flash plugin installed.

I am on OS X version 10.8.5, mac mini server

Thanks

Todd

JW Player Support Agent  
0 rated :

Try jwplayer().onBeforePlay() instead of jwplayer().onPlay()

This question has received the maximum number of answers.