3
A
回答
0
嘗試設置以下
<div id="mediaContent">
<video id="mediaPlayer" width="100%" height="100%">
<source type="video/mp4" src="http://clips.vorwaerts-gmbh.debig_buck_bunny.mp4" />
</video>
</div>
然後設置在CSS的div容器mediaContent是什麼都大小你想要的。 視頻將重新調整容器大小。 嚴格地說,寬度和高度應該是絕對像素尺寸,但設置爲%有效。
然後你可以有基於上述答案設置了一些元素像
$(document).ready(function() {
var myPlayer = $('#mediaPlayer');
var w = parseInt($('#mediaContent').css('width'));
var h = parseInt($('#mediaContent').css('height')) ;
myPlayer.mediaelementplayer({
// if the <video width> is not specified, this is the default
defaultVideoWidth: w ,
// if the <video height> is not specified, this is the default
defaultVideoHeight: h,
// if set, overrides <video width>
videoWidth: -1,
// if set, overrides <video height>
videoHeight: -1,
// width of audio player
audioWidth: 400,
// height of audio player
audioHeight: 30,
// initial volume when the player starts
startVolume: 0.8,
// useful for <audio> player loops
loop: false,
// enables Flash and Silverlight to resize to content size
enableAutosize: true,
// the order of controls you want on the control bar (and other plugins below)
features: ['playpause', 'progress', 'current', 'duration', 'tracks', 'volume', 'fullscreen'],
// Hide controls when playing and mouse is not over the video
alwaysShowControls: false,
// forces the hour marker (##:00:00)
alwaysShowHours: false,
// show framecount in timecode (##:00:00:00)
showTimecodeFrameCount: false,
// used when showTimecodeFrameCount is set to true
framesPerSecond: 25,
// turns keyboard support on and off for this instance
enableKeyboard: true,
// when this player starts, it will pause other players
pauseOtherPlayers: true,
// array of keyboard commands
keyActions: []
});
});
0
,下面的一個工作對我來說:
// Get video container width and height
var w = $('#video').parent().width();
var h = $('#video').parent().height();
$('#video')
.attr('width', w)
.attr('height', h)
.delay(500) // don't know why, but without this sometimes it doesn't work.
.mediaelementplayer({
defaultVideoWidth: w
, defaultVideoHeight: h
, videoWidth: -1
, videoHeight: -1
, enableAutosize: true
});
相關問題
- 1. 拉伸UL填滿整個DIV
- 2. 拉伸視頻?
- 3. 填充拉伸div寬HTML5
- 4. 如何讓最後一個div拉伸填滿屏幕?
- 5. HTML 5視頻拉伸
- 6. Chromecast - 如何拉伸視頻
- 7. Flexbox拉伸div高度以填充父div的剩餘高度
- 8. 拉伸水平div(中間div拉伸)
- 9. 視頻拉伸不起作用
- 10. Flash視頻使用HTML5後備mediaelement.js
- 11. surfaceview播放視頻的拉伸視圖
- 12. 延伸divs高度以填滿未使用的空間
- 13. Autolayout - 拉伸視圖以填充其父視圖
- 14. mediaelement.js - 播放隨機視頻?
- 15. DIV標籤高度不會拉伸以填充父空間
- 16. 拉伸文本字段按鈕,以填補父DIV
- 17. 如何完全拉伸視頻
- 18. HTML5視頻撕裂/拉伸 - 火狐
- 19. 視頻拉伸問題iOS Swift
- 20. 使用mediaelement.js音頻自動暫停mediaelement.js音頻播放器
- 21. 表格拉伸div
- 22. 拉伸div內容
- 23. 的Android的TableRow垂直拉伸填滿屏幕
- 24. QWebView:拉伸以填充屏幕尺寸?
- 25. FlutterLogo可以拉伸填充嗎?
- 26. 拉伸列以填充的DataGrid
- 27. MediaElement.js - HTML5音頻和視頻如何在Wordpress中使用
- 28. MediaElement.js使用同一個播放器播放音頻和視頻
- 29. 需要拉伸TextView跨度以填充整個視圖
- 30. 獲取圖像以拉伸div