English 中文(简体)
如何用固定时间抵消起算时间
原标题:How to set start time offset using setCurrentTime()

我对讲稿进行了记录,我希望让用户在录音中某个具体时间开始录音,例如在开始时间之后12.5秒。 利用下面的样本代码,我如何能够做到这一点?

<audio id="player2" src="/player/media/AirReview-Landmarks-02-ChasingCorporate.mp3" type="audio/mp3" controls="controls"  preload="preload">
</audio>

<script>
var player = $( audio,video ).mediaelementplayer(
{
        // the order of controls you want on the control bar (and other plugins below)
        features: [ playpause , progress , current , duration , tracks , volume , fullscreen ],
        audioWidth: 300,
        // enables Flash and Silverlight to resize to content size
        enableAutosize: true,
        startVolume: 0.7, 
        success: function(player, node) { 
                $( #  + node.id +  -mode ).html( mode:   + player.pluginType); 
        }
}
);
</script>
问题回答

作者:

var myplayer = jQuery( #your_player )["0"];

规定时间(例如12.5):

myplayer.player.setCurrentTime(12.5);
myplayer.player.setCurrentRail();

:

我能够说明如何控制媒体。 参与者必须采用一个变量进行初始化。

<video id="player1" width="720" height="406" controls="controls" preload="none">
    <source src="myvid.mp4" type="video/mp4" />
</video>

<a href="#" class="mpplay">play</a>
<a href="#" class="mppause">pause</a>
<a href="#" class="mptime">1:00</a>
<a href="#" class="mptime">0:30</a>

<script>

function convert(input) {
    var parts = input.split( : ),
        minutes = +parts[0],
        seconds = +parts[1];
    return (minutes * 60 + seconds).toFixed(2);
}

jQuery(document).ready(function($) {
    // declare object for video
    var player = new MediaElementPlayer( #player1 );

     jQuery( .mpplay ).click(function() {
        player.play();
     });

     jQuery( .mppause ).click(function() {
        player.pause();
     });

     jQuery( .mptime ).click(function() {
        var timeToGoVideo = "";
        timeToGoVideo = (this).text;
        timeToGoVideo = convert(timeToGoVideo);
        player.setCurrentTime(timeToGoVideo);
        player.setCurrentRail();
        player.play();
     });

});

</script>




相关问题
MediaElement.js jquery bug

I have an gwt application and I use MediaElement.js to show multimedia contents. If I put on the main page this script <script> // using jQuery $( video,audio ).mediaelementplayer(); <...

FancyBox + MediaElement player + IE

Trying to incorporate the mediaelement.js player into a lightbox (fancybox.net). Player works in IE without FancyBox. FancyBox works in IE with regular text content. But The player + fancybox ...

Still trying to stop video from rewinding in mediaelement.js

I am still having problems with the code not stopping the video from rewinding to the beginning. The code that John posted doesn t seem to be working for me. He said: I believe that the default ...

Continuous play for Mediaelement.js

I have a music blog (http://www.lowerfrequencies.com/) in which I have and embed Mediaelement.js audio file in every post. It works great and I have no complaints. However, I would like it if I could ...

Mediaelement.js javascript error in IE

I m using MediaElement.js as my HTML5 video player for a site in progress. It works fine in Chrome, Safari, and Firefox, even with the fallback player, but in Internet Explorer I get the Javascript ...

热门标签