var htmlPlayer = document.getElementsByTagName('video');
function pausePlayer() {
for(var i = 0; i < htmlPlayer.length; i++){
htmlPlayer[i].pause();
}
}
IOS
Search This Blog
Thứ Năm, 4 tháng 4, 2019
Tạm dừng video trong ios
Thứ Hai, 10 tháng 12, 2018
Xóa cache in ios
URLCache.shared.removeAllCachedResponses()
URLCache.shared.diskCapacity = 0
URLCache.shared.memoryCapacity = 0
if let cookies = HTTPCookieStorage.shared.cookies {
for cookie in cookies {
HTTPCookieStorage.shared.deleteCookie(cookie)
}
}
func clear(cache: Bool, cookies: Bool) {
if cache { clearCache() }
if cookies { clearCookies() }
}
fileprivate func clearCache() {
URLCache.shared.removeAllCachedResponses()
URLCache.shared.diskCapacity = 0
URLCache.shared.memoryCapacity = 0
}
fileprivate func clearCookies() {
let cookieStorage = HTTPCookieStorage.shared
guard let cookies = cookieStorage.cookies else { return }
for cookie in cookies {
cookieStorage.deleteCookie(cookie)
}
}
Thứ Tư, 21 tháng 11, 2018
Thứ Hai, 19 tháng 11, 2018
Lấy phiên bản hiện tại trong ios
let appVersion = Bundle.main.infoDictionary!["CFBundleShortVersionString"] as? String
//First get the nsObject by defining as an optional anyObject let nsObject: AnyObject? = NSBundle.mainBundle().infoDictionary["CFBundleShortVersionString"] //Then just cast the object as a String, but be careful, you may want to double check for nil let version = nsObject as String
Lỗi không có âm thanh trên video
try! AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback, with: [])
Thứ Ba, 6 tháng 11, 2018
Tao bien mo rong in ios
extension Notification.Name {
static var kAVPlayerViewControllerDismissingNotification = Notification.Name.init("dismissing")
}
Thứ Năm, 25 tháng 10, 2018
Thay thế chuổi trong ios
let updated = foo.replacingOccurrences(of: "\r\n|\n|\r", with: "", options: .regularExpression)
Đăng ký:
Nhận xét (Atom)