MediaElement(版本2.16.4)iframe全屏视频问题 - firefox,IE11

时间:2015-04-30 13:40:35

标签: firefox iframe fullscreen internet-explorer-11 mediaelement.js

我正在使用mediaelement.js版本2.16.4在由thickbox.js创建的iframe中加载视频。当我尝试点击firefox-37.0.2 / IE-11中的全屏按钮时,视频会进入全屏状态,但会立即返回到较小尺寸的iframe。如果我不初始化mediaelement而只初始化HTML5标记,那么全屏在iframe中工作正常。所以,它必须与mediaelement播放器做一些事情。这不会发生在Chrome中!任何人都可以在这里指导我为什么会这样,以及如何解决它?

仅供参考:我在iframe中有“webkitallowfullscreen mozallowfullscreen allowfullscreen”。

<video id="videoPlayer" width="100%" height="100%" controls="controls" preload="none" autoplay="true">
        <source type="video/mp4" src="<%=Url%>" />
    </video>

$(document).ready(function() {

    if ($('video')) {
       var player =  $('video').mediaelementplayer({
            videoWidth: '100%',
            videoHeight: '100%',
            // initial volume when the player starts
            startVolume: 0.8,
            // 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', 'current', 'progress', 'duration', 'tracks', 'volume', 'fullscreen'],
            // Hide controls when playing and mouse is not over the video
            alwaysShowControls: false,
            isNativeFullScreen: true,
            success: function (mediaElement, domObject, player) {
                mediaElement.addEventListener('ended', function () {
                    player.exitFullScreen();
                }, false);
            }
       });


    }

});

1 个答案:

答案 0 :(得分:1)

我在firefox / IE中发现了全屏问题。这是mediaelement-and-player.js中的以下代码,其中有一个全屏手动退出。对我来说,'zoomMultiplier'变量是1.25,这导致了问题。我可以评论这段代码,但不确定它是否会破坏其他情况? -

//
//  ViewController_no_status_bar.swift
//  hide the status bar
//
//  Created by Scott Yannitell on 4/30/15.
//  Copyright (c) 2015 ohiovr.com. All rights reserved.
//

import UIKit

var statusBarIsHidden = true
class ViewController_no_status_bar: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }

    override func prefersStatusBarHidden () -> Bool {return statusBarIsHidden}

}
相关问题