Need some code samples (Fast Forward, Rew and other)

Please, I need samples of JavaScript code (some strings) and some comments for following operations:

  • Fast Forward
  • Rew
  • Go To Next Chapter
  • Go To Previous Chapter

P.S.

I tried to use Player.playlist.fastForward(4); and seen JS error (iHDScript API fastForward: HDDVD_E_ARGUMENT) on this string. Why is "4" incorrect argument I think that 4 is: (normal speed) * 4. I mistaken

For Player.playlist.stepForward(); I see following error: iHDScript API stepForward: HDDVD_E_NOTSUPPORTED

P.P.S.

Sorry, I known that my question is RTFM but I don't have specefication. :(



Answer this question

Need some code samples (Fast Forward, Rew and other)

  • Kaltenberg

    thanks closer. I am not sure of code . you try that pls

    1) As per spec, speed::=[0-9]+("."[0-9]+)

    2) we cant change the values because Array of fastForwardSpeed(and all) is readonly


  • flypp3r

    The value passed to fastForward is an index to the array provided by fastForwardSpeed property. So you have to check first if 4 within the valid range (if fastForwardSpeed returns only 3 fast forward speed, fastForward(4) will fail).

    About stepForward: HDDVD_E_NOTSUPPORTED means that stepForward functionality is not supported by the player, so the is nothing you can do.



  • Jawad Naeem

    GREAT!!! Thanks bharathi_tunes!

    I made following code:

    Previous Chapter:
    var totalChaptersInTitle = Player.playlist.currentTitle.chapters.length;
    var currentChapter = Player.playlist.currentChapter.number;
    var previouseChapter = Math.max(currentChapter - 1, 0);
    var startChapterTime = Player.playlist.currentTitle.chapters[previouseChapter].attributes.titleTimeBegin;
    Player.playlist.currentTitle.jump(startChapterTime, false);

    Next Chapter:
    var totalChaptersInTitle = Player.playlist.currentTitle.chapters.length;
    var currentChapter = Player.playlist.currentChapter.number;
    var nextChapter = Math.min(currentChapter + 1, totalChaptersInTitle - 1);
    var startChapterTime = Player.playlist.currentTitle.chapters[nextChapter].attributes.titleTimeBegin;
    Player.playlist.currentTitle.jump(startChapterTime, false);

    Rew:
    var length = Player.playlist.fastReverseSpeed.length;
    if(length > 0)
    Player.playlist.fastReverse(length - 1);

    Fast Forward:
    var length = Player.playlist.fastForwardSpeed.length;
    if(length > 0)
    Player.playlist.fastForward(length - 1);


    But I have two question:
    1) Why by default fastForwardSpeed[0] = 2.0, but fastReverseSpeed[0] = 8.0 Is it normal

    2) Can I change that values (fastForwardSpeed[0] and fastReverseSpeed[0]) Will it work correctly on hardware devices (HD-DVD players)


  • Kickaha

    It is up to the player manufacturer to decide how they will do trick play.

    One guess is that it is easier to decode video in fast forward than it is in rewind, due to the way frames are encoded as diffs on previous frames, etc.



  • BitShift

    To check whether player capability for playback

    Player.capabilities.playback.slowForward will return true or false. similarly for slowReverse, stepForward and stepReverse.

    if(Player.capabilities.playback.slowForward )

    {

           var arrLength = Player.playlist.slowForwardSpeed.length;

         //use this arrLength for selecting speed

    }

    fastForward and fastReverse are not the members in playbackCapabilities object. So directly you can check that array length and use it for selecting speed.

    To go to previous chapter (i am not sure)

    1)chNum = Player.playlist.currentChapter.number        //gives current chapter number

    2)chLen = Player.playlist.currentTitle.chapters.length       // gives total number of chapters in current title

    3)stTime=Player.playlist.currentTitle.chapters[chNum-2].attributes.titleTimeBegin     

    // gives the starting time(in terms of title timeline) of pervious chapter if present

    4) Player.playlist.currentTitle.jump(stTime, false);  // jump to previous chapter in current title

    To go to next chapter

    1)stTime = Player.playlist.currentTitle.chapters[chNum].attributes.titleTimeBegin   

       // gives the starting time(in terms of title timeline) of next       chapter if present

    2)Player.playlist.currentChapter.jump(stTime, false);        //jump to next chapter if present


  • MOHAMMED1

    1) As per spec, speed::=[0-9]+("."[0-9]+)

    Sorry, I wanted to ask: Why the "Rew" speed is higher than the "Fast forward" speed Because when I'm calling "Rew", I see frame blinking. But when I'm calling "Fast Forward" I see normal fast video (without blinking).


  • Need some code samples (Fast Forward, Rew and other)