Created
December 8, 2018 14:03
-
-
Save ayoub-9/f7f7d4a1bb8f078962d256a13f3bad85 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // ViewController.swift | |
| // NLM | |
| // | |
| // Created by Ayoub Alrshidi on 28/03/1440 AH. | |
| // Copyright © 1440 Ayoub Alrshidi. All rights reserved. | |
| // | |
| import UIKit | |
| import WebKit | |
| import AVFoundation | |
| class ViewController: UIViewController { | |
| @IBOutlet weak var webkit: WKWebView! | |
| var player:AVAudioPlayer = AVAudioPlayer() | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| do | |
| { | |
| let audioPath = Bundle.main.path(forResource: "withOut", ofType: "mp3") | |
| try player = AVAudioPlayer(contentsOf: NSURL(fileURLWithPath: audioPath!) as URL) | |
| } | |
| catch | |
| { | |
| //PROCESS ERROR | |
| } | |
| let session = AVAudioSession.sharedInstance() | |
| do | |
| { | |
| try session.setCategory(.playback, mode: .default) | |
| try AVAudioSession.sharedInstance().setActive(true) | |
| } | |
| catch | |
| { | |
| } | |
| player.play() | |
| } | |
| override func didReceiveMemoryWarning() { | |
| super.didReceiveMemoryWarning() | |
| // Dispose of any resources that can be recreated. | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment